@apify/ui-library 0.65.3-featuresyntaxhighlighter-48cb44.36 → 0.65.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/CHANGELOG.md +8 -0
- package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.js +20 -14
- package/dist/src/components/code/code_block/code_block.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.d.ts +2 -8
- package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.js +68 -14
- package/dist/src/components/code/code_block/code_block.styled.js.map +1 -1
- package/dist/src/components/code/code_block/utils.d.ts +1 -5
- package/dist/src/components/code/code_block/utils.d.ts.map +1 -1
- package/dist/src/components/code/code_block/utils.js +12 -23
- package/dist/src/components/code/code_block/utils.js.map +1 -1
- package/dist/src/components/code/index.d.ts +0 -1
- package/dist/src/components/code/index.d.ts.map +1 -1
- package/dist/src/components/code/index.js +0 -1
- package/dist/src/components/code/index.js.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.d.ts.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.js +23 -5
- package/dist/src/components/code/one_line_code/one_line_code.js.map +1 -1
- package/dist/src/components/code/syntax_highlighter.d.ts +15 -0
- package/dist/src/components/code/syntax_highlighter.d.ts.map +1 -0
- package/dist/src/components/code/syntax_highlighter.js +103 -0
- package/dist/src/components/code/syntax_highlighter.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/components/code/code_block/code_block.styled.tsx +69 -21
- package/src/components/code/code_block/code_block.tsx +36 -25
- package/src/components/code/code_block/utils.ts +19 -0
- package/src/components/code/index.ts +0 -1
- package/src/components/code/one_line_code/one_line_code.tsx +28 -9
- package/src/components/code/syntax_highlighter.tsx +134 -0
- package/dist/src/components/code/prism_highlighter.d.ts +0 -13
- package/dist/src/components/code/prism_highlighter.d.ts.map +0 -1
- package/dist/src/components/code/prism_highlighter.js +0 -116
- package/dist/src/components/code/prism_highlighter.js.map +0 -1
- package/src/components/code/code_block/utils.tsx +0 -50
- package/src/components/code/prism_highlighter.tsx +0 -178
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.65.3](https://github.com/apify/apify-core/compare/@apify/ui-library@0.65.2...@apify/ui-library@0.65.3) (2025-04-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @apify/ui-library
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.65.2](https://github.com/apify/apify-core/compare/@apify/ui-library@0.65.1...@apify/ui-library@0.65.2) (2025-04-22)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code_block.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"code_block.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,KAAK,OAAO,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAA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
|
3
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { ColorWheelGradient } from '../../color_wheel_gradient.js';
|
|
5
5
|
import { Link } from '../../link.js';
|
|
6
6
|
import { Text } from '../../text/index.js';
|
|
7
7
|
import { ActionButton, CopyButton } from '../action_button.js';
|
|
8
|
-
import {
|
|
8
|
+
import { SyntaxHighlighter } from '../syntax_highlighter.js';
|
|
9
9
|
import { CodeBlockWrapper } from './code_block.styled.js';
|
|
10
|
-
import {
|
|
10
|
+
import { mapPrefixToBashLine } from './utils.js';
|
|
11
11
|
const LANGUAGES_WITHOUT_LINE_NUMBERS = ['json', 'jsonp', 'jsonp', 'rss', 'yaml', 'xml', 'html', 'bash', 'text', 'dockerfile', 'http'];
|
|
12
12
|
const HeaderDots = () => {
|
|
13
13
|
return (_jsxs("div", { className: "CodeBlock-HederDotsWrapper", children: [_jsx("div", { className: "CodeBlock-HeaderDot" }), _jsx("div", { className: "CodeBlock-HeaderDot" }), _jsx("div", { className: "CodeBlock-HeaderDot" })] }));
|
|
@@ -38,7 +38,9 @@ export const CodeBlock = ({ content, size, language, highlightLines, onTabChange
|
|
|
38
38
|
const currentLanguage = language ?? currentTab?.language;
|
|
39
39
|
const currentHighlightLines = useMemo(() => (isMultiTab ? currentTab?.highlightLines ?? [] : highlightLines), [isMultiTab, currentTab, highlightLines]);
|
|
40
40
|
const isBash = currentLanguage === 'bash';
|
|
41
|
-
const showLineNumbers = !hideLineNumbers
|
|
41
|
+
const showLineNumbers = !hideLineNumbers
|
|
42
|
+
&& !LANGUAGES_WITHOUT_LINE_NUMBERS.includes(currentLanguage ?? '');
|
|
43
|
+
const showBashPrompt = isBash && !hideBashPromptPrefixes;
|
|
42
44
|
const showBashHeader = isBash && !hideBashHeader && !isMultiTab;
|
|
43
45
|
const showHeader = isMultiTab || !!title || showBashHeader;
|
|
44
46
|
const syntaxHighlighterRef = useRef(null);
|
|
@@ -47,17 +49,21 @@ export const CodeBlock = ({ content, size, language, highlightLines, onTabChange
|
|
|
47
49
|
setCurrentTab(tab);
|
|
48
50
|
syntaxHighlighterRef.current?.scrollTo(0, 0);
|
|
49
51
|
};
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const currentBashLinesPrefixes = useMemo(() => {
|
|
53
|
+
if (!showBashPrompt)
|
|
54
|
+
return [];
|
|
55
|
+
return mapPrefixToBashLine(currentCode, currentTab?.bashCommandsStart ?? bashCommandsStart);
|
|
56
|
+
}, [currentCode, bashCommandsStart, showBashPrompt, currentTab]);
|
|
57
|
+
const getLineProps = useCallback((lineNumber) => {
|
|
58
|
+
const data = [];
|
|
59
|
+
if (currentHighlightLines?.includes(lineNumber)) {
|
|
60
|
+
data.push('highlighted');
|
|
55
61
|
}
|
|
56
|
-
if (
|
|
57
|
-
|
|
62
|
+
if (showBashPrompt) {
|
|
63
|
+
data.push(currentBashLinesPrefixes[lineNumber - 1]);
|
|
58
64
|
}
|
|
59
|
-
return {};
|
|
60
|
-
}, [
|
|
61
|
-
return (_jsxs(CodeBlockWrapper, { "$hasHeader": showHeader, "$gradientRotation": gradientRotation, "$hasActionButton": showActionButton, "$hasTabs": isMultiTab, "$fullWidth": fullWidth, "$fullHeight": fullHeight, "$showLineNumbers": showLineNumbers, ...rest, children: [showHeader && (_jsx(Header, { tabs: isMultiTab ? content : null, currentTab: currentTab, onTabChange: handleTabClick, showBashHeader: showBashHeader, title: title })), _jsx(
|
|
65
|
+
return { data: data.join(' ') };
|
|
66
|
+
}, [currentHighlightLines, showBashPrompt, currentBashLinesPrefixes]);
|
|
67
|
+
return (_jsxs(CodeBlockWrapper, { "$hasHeader": showHeader, "$gradientRotation": gradientRotation, "$hasActionButton": showActionButton, "$hasTabs": isMultiTab, "$fullWidth": fullWidth, "$fullHeight": fullHeight, "$showLineNumbers": showLineNumbers, ...rest, children: [showHeader && (_jsx(Header, { tabs: isMultiTab ? content : null, currentTab: currentTab, onTabChange: handleTabClick, showBashHeader: showBashHeader, title: title })), _jsx(SyntaxHighlighter, { showLineNumbers: true, wrapLines: true, language: currentLanguage, size: size, lineProps: getLineProps, ref: syntaxHighlighterRef, children: currentCode }), _jsxs("div", { className: "CodeBlock-TopRightActionsWrapper", children: [showActionButton && _jsx(ActionButton, { successStyle: true, onClick: onActionButtonClick, children: actionButtonLabel ?? 'Run on Apify' }), !hideCopyButton && _jsx(CopyButton, { code: currentCode })] }), showGradient && (_jsx(ColorWheelGradient, { className: "CodeBlock-Gradient", blurSize: 69 }))] }));
|
|
62
68
|
};
|
|
63
69
|
//# sourceMappingURL=code_block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code_block.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"code_block.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqBjD,MAAM,8BAA8B,GAAG,CAAC,MAAM,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AAE,GACd,CACL,IACe,CACvB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
$fullWidth?: boolean;
|
|
4
|
-
$fullHeight?: string;
|
|
5
|
-
$showLineNumbers?: boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare const SyntaxHighlighterBaseStylesWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../box.js").BoxProps & import("react").RefAttributes<HTMLElement>>, any, SyntaxHighlighterBaseStylesWrapperProps, never>;
|
|
8
|
-
export declare const CodeBlockWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../box.js").BoxProps & import("react").RefAttributes<HTMLElement>>, any, SyntaxHighlighterBaseStylesWrapperProps & {
|
|
1
|
+
import type { SharedTextSize } from '../../text/text_shared.js';
|
|
2
|
+
export declare const CodeBlockWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../box.js").BoxProps & import("react").RefAttributes<HTMLElement>>, any, import("../syntax_highlighter.js").SyntaxHighlighterBaseStylesWrapperProps & {
|
|
9
3
|
$hasHeader: boolean;
|
|
10
4
|
$gradientRotation?: number;
|
|
11
5
|
$highlightLines?: number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code_block.styled.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.styled.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code_block.styled.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.styled.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKhE,eAAO,MAAM,gBAAgB;gBACb,OAAO;wBACC,MAAM;sBACR,MAAM,EAAE;uBACP,OAAO;eACf,OAAO;iBACL,OAAO;uBACD,OAAO;kBACZ,OAAO;WACd,cAAc;SAkNxB,CAAC"}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { theme } from '../../../design_system/theme.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
background-color: ${theme.color.neutral.backgroundMuted} !important;
|
|
6
|
-
border: 1px solid ${theme.color.neutral.border};
|
|
7
|
-
border-radius: ${theme.radius.radius12};
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
|
|
10
|
-
width: 100%;
|
|
11
|
-
${({ $fullWidth }) => !$fullWidth && css `max-width: 860px;`}
|
|
12
|
-
${({ $fullHeight }) => !$fullHeight && css `max-height: 600px;`}
|
|
13
|
-
|
|
14
|
-
background-color: transparent;
|
|
15
|
-
position: relative;
|
|
16
|
-
`;
|
|
3
|
+
import { SyntaxHighlighterBaseStylesWrapper } from '../syntax_highlighter.js';
|
|
4
|
+
const HIGHLIGHT_BACKGROUND_COLOR = 'rgba(22, 114, 235, 0.05)';
|
|
17
5
|
export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper) `
|
|
18
6
|
position: relative;
|
|
19
7
|
display: flex;
|
|
@@ -103,6 +91,72 @@ export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper) `
|
|
|
103
91
|
}
|
|
104
92
|
}
|
|
105
93
|
|
|
94
|
+
.CodePre {
|
|
95
|
+
z-index: 2;
|
|
96
|
+
padding: ${theme.space.space16} 0 !important;
|
|
97
|
+
|
|
98
|
+
code {
|
|
99
|
+
& > span {
|
|
100
|
+
display: block;
|
|
101
|
+
padding-left: ${({ $showLineNumbers }) => ($showLineNumbers ? theme.space.space8 : theme.space.space16)};
|
|
102
|
+
padding-right: ${theme.space.space16};
|
|
103
|
+
&:hover {
|
|
104
|
+
background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
|
|
105
|
+
border-left: 6px solid ${theme.color.neutral.border} !important;
|
|
106
|
+
padding-left: ${({ $showLineNumbers }) => ($showLineNumbers ? '0.2' : '1')}rem;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Common styles
|
|
111
|
+
[data*='bash']{
|
|
112
|
+
&::before {
|
|
113
|
+
color: ${theme.color.lavender.base};
|
|
114
|
+
padding-right: ${theme.space.space16};
|
|
115
|
+
min-width: ${theme.space.space24};
|
|
116
|
+
user-select: none;
|
|
117
|
+
-webkit-user-select: none;
|
|
118
|
+
font-size: 1em;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[data*='bashStartCommand'] {
|
|
123
|
+
&::before {
|
|
124
|
+
content: '$';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
[data*='bashCommand'] {
|
|
129
|
+
&::before {
|
|
130
|
+
content: '>';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[data*='bashEmptyLine'] {
|
|
135
|
+
&::before {
|
|
136
|
+
content: ' ';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[data*='highlighted'] {
|
|
141
|
+
background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
|
|
142
|
+
border-left: 6px solid ${theme.color.neutral.border} !important;
|
|
143
|
+
padding-left: ${({ $showLineNumbers }) => ($showLineNumbers ? '0.2' : '1')}rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
.linenumber {
|
|
148
|
+
color: ${theme.color.neutral.textSubtle} !important;
|
|
149
|
+
padding-right: ${theme.space.space16} !important;
|
|
150
|
+
min-width: ${theme.space.space24} !important;
|
|
151
|
+
box-sizing: unset !important;
|
|
152
|
+
user-select: none;
|
|
153
|
+
-webkit-user-select: none;
|
|
154
|
+
|
|
155
|
+
${({ $showLineNumbers }) => (!$showLineNumbers && css `display: none !important;`)}
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
106
160
|
|
|
107
161
|
.CodeBlock-TopRightActionsWrapper {
|
|
108
162
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code_block.styled.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.styled.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"code_block.styled.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.styled.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,OAAO,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AAE9E,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAUxE;;;;;;;;eAQa,KAAK,CAAC,KAAK,CAAC,MAAM;4BACL,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB;mCAC7B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;;;;;;;2BAOlC,KAAK,CAAC,KAAK,CAAC,OAAO;6BACjB,KAAK,CAAC,KAAK,CAAC,MAAM;;;;;;;6BAOlB,KAAK,CAAC,KAAK,CAAC,OAAO;4BACpB,KAAK,CAAC,KAAK,CAAC,MAAM;;;mBAG3B,KAAK,CAAC,KAAK,CAAC,MAAM;;4BAET,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;;;iCAGtD,KAAK,CAAC,MAAM,CAAC,OAAO;;;;;;;;;;yBAU5B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS;;;;;kCAKpB,KAAK,CAAC,KAAK,CAAC,MAAM,W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CAAC,KAAK,CAAC,OAAO;6BACvB,KAAK,CAAC,KAAK,CAAC,OAAO;;;;;kBAK9B,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,IAAI,GAAG,CAAA,2BAA2B,CAAC;;;;;;;;;;UAUvF,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU;IACjC,CAAC,CAAC,GAAG,CAAA;;6BAEgB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG;IAC1C,CAAC,CAAC,GAAG,CAAA;2BACc,KAAK,CAAC,KAAK,CAAC,OAAO;6BACjB,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC;;;eAGrC,KAAK,CAAC,KAAK,CAAC,MAAM;;;;UAIvB,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,IAAI,GAAG,CAAA;gCACf,KAAK,CAAC,KAAK,CAAC,OAAO;;;;sBAI7B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB;;aAE7C;;;;;;;;;;gDAUmC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,iBAAiB,IAAI,CAAC;;;;;mBAK9E,KAAK,CAAC,KAAK,CAAC,MAAM;;eAEtB,KAAK,CAAC,KAAK,CAAC,MAAM;;uBAEV,KAAK,CAAC,KAAK,CAAC,MAAM;;;;;;;gCAOT,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU;;;CAG7D,CAAC"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getBashLinePrefixes: (code: string, bashCommandsStart?: number[]) => {
|
|
3
|
-
[k: string]: import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
};
|
|
5
|
-
export declare const getNumberLinePrefixes: (code: string) => Record<number, ReactNode>;
|
|
1
|
+
export declare const mapPrefixToBashLine: (code: string, bashCommandsStart?: number[]) => ("bashEmptyLine" | "bashStartCommand" | "bashCommand")[];
|
|
6
2
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/utils.
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,SAAU,MAAM,sBAAqB,MAAM,EAAE,6DAa5E,CAAC"}
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { theme } from '../../../design_system/theme.js';
|
|
3
|
-
import { CodeHighlighterLinePrefix } from '../prism_highlighter.js';
|
|
4
1
|
// input: [2, 4, 5, 6, 8, 10, 11, 12]
|
|
5
2
|
// returns string indicating what type of line it is (bashStartCommand, bashCommand, bashEmptyLine)
|
|
6
3
|
// commands start -> bashStartCommand
|
|
7
4
|
// every next line after command start until next command start or empty line -> bashCommand
|
|
8
|
-
|
|
5
|
+
// empty line or comment -> bashEmptyLine
|
|
6
|
+
export const mapPrefixToBashLine = (code, bashCommandsStart = []) => {
|
|
9
7
|
const lines = code.split('\n').map((line) => line.trim());
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return (_jsx(CodeHighlighterLinePrefix, {}));
|
|
21
|
-
}
|
|
22
|
-
return (_jsx(CodeHighlighterLinePrefix, { color: theme.color.lavender.base, children: "<" }));
|
|
8
|
+
// by default each line that is not empty or comment is a command start
|
|
9
|
+
if (bashCommandsStart.length === 0) {
|
|
10
|
+
return lines.map((line) => ((line.startsWith('#') || !line) ? 'bashEmptyLine' : 'bashStartCommand'));
|
|
11
|
+
}
|
|
12
|
+
return lines.map((line, i) => {
|
|
13
|
+
if (bashCommandsStart.includes(i + 1))
|
|
14
|
+
return 'bashStartCommand';
|
|
15
|
+
if (line.startsWith('#') || !line)
|
|
16
|
+
return 'bashEmptyLine';
|
|
17
|
+
return 'bashCommand';
|
|
23
18
|
});
|
|
24
|
-
return Object.fromEntries(bashLinePrefixesArray.map((linePrefix, i) => [i + 1, linePrefix]));
|
|
25
|
-
};
|
|
26
|
-
export const getNumberLinePrefixes = (code) => {
|
|
27
|
-
const numberOfLines = code.split('\n').length;
|
|
28
|
-
const numbersArray = Array.from({ length: numberOfLines }, (_, i) => i + 1);
|
|
29
|
-
return Object.fromEntries(numbersArray.map((number) => [number, _jsx(CodeHighlighterLinePrefix, { children: number })]));
|
|
30
19
|
};
|
|
31
20
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/utils.
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/utils.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,mGAAmG;AACnG,qCAAqC;AACrC,4FAA4F;AAC5F,yCAAyC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,oBAA8B,EAAE,EAAE,EAAE;IAClF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAE1D,uEAAuE;IACvE,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzG,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACzB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,kBAAkB,CAAC;QACjE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,eAAe,CAAC;QAC1D,OAAO,aAAa,CAAC;IACzB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -2,5 +2,4 @@ export * from './code_block/code_block.js';
|
|
|
2
2
|
export * from './code_block/code_block_with_tabs.js';
|
|
3
3
|
export * from './one_line_code/one_line_code.js';
|
|
4
4
|
export * from './inline_code/inline_code.js';
|
|
5
|
-
export * from './prism_highlighter.js';
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/code/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/code/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC"}
|
|
@@ -2,5 +2,4 @@ export * from './code_block/code_block.js';
|
|
|
2
2
|
export * from './code_block/code_block_with_tabs.js';
|
|
3
3
|
export * from './one_line_code/one_line_code.js';
|
|
4
4
|
export * from './inline_code/inline_code.js';
|
|
5
|
-
export * from './prism_highlighter.js';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/code/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/code/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one_line_code.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/one_line_code/one_line_code.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"one_line_code.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/one_line_code/one_line_code.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKhE,eAAO,MAAM,qBAAqB;;;;;;CAMjC,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AA6HvE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAA;AAED,wBAAgB,WAAW,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,iBAAyB,EACzB,MAAM,EACN,QAAQ,EACR,cAAc,EACd,GAAG,IAAI,EACV,EAAE,gBAAgB,2CA0DlB"}
|
|
@@ -5,8 +5,7 @@ import { EyeIcon, EyeOffIcon } from '@apify/ui-icons';
|
|
|
5
5
|
import { theme } from '../../../design_system/theme.js';
|
|
6
6
|
import { Text } from '../../text/index.js';
|
|
7
7
|
import { ActionButton, CopyButton } from '../action_button.js';
|
|
8
|
-
import { SyntaxHighlighterBaseStylesWrapper } from '../
|
|
9
|
-
import { PrismSyntaxHighlighter } from '../prism_highlighter.js';
|
|
8
|
+
import { SyntaxHighlighter, SyntaxHighlighterBaseStylesWrapper } from '../syntax_highlighter.js';
|
|
10
9
|
export const oneLineCodeClassNames = {
|
|
11
10
|
gradientWrapper: 'OneLineCode-GradientWrapper',
|
|
12
11
|
scrollableWrapper: 'OneLineCode-ScrollableWrapper',
|
|
@@ -72,7 +71,6 @@ const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper) `
|
|
|
72
71
|
top: 0;
|
|
73
72
|
bottom: 0;
|
|
74
73
|
width: 4rem;
|
|
75
|
-
z-index: 5;
|
|
76
74
|
background: linear-gradient(
|
|
77
75
|
to right,
|
|
78
76
|
transparent,
|
|
@@ -95,12 +93,32 @@ const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper) `
|
|
|
95
93
|
scrollbar-color: ${theme.color.neutral.border} transparent;
|
|
96
94
|
|
|
97
95
|
|
|
98
|
-
|
|
96
|
+
.CodePre {
|
|
99
97
|
overflow: unset !important;
|
|
100
98
|
display: flex;
|
|
101
99
|
flex: 1;
|
|
102
100
|
align-items: center;
|
|
103
101
|
height: 2.8rem;
|
|
102
|
+
|
|
103
|
+
code {
|
|
104
|
+
& > span {
|
|
105
|
+
text-overflow: ellipsis;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
vertical-align: text-top;
|
|
109
|
+
${({ $showBashPrefixes }) => $showBashPrefixes && css `
|
|
110
|
+
&::before {
|
|
111
|
+
color: ${theme.color.lavender.base};
|
|
112
|
+
padding-right: ${theme.space.space16};
|
|
113
|
+
min-width: ${theme.space.space24};
|
|
114
|
+
user-select: none;
|
|
115
|
+
-webkit-user-select: none;
|
|
116
|
+
content: "$";
|
|
117
|
+
font-size: 1em;
|
|
118
|
+
}
|
|
119
|
+
`}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
`;
|
|
@@ -114,6 +132,6 @@ export function OneLineCode({ children, language, size, httpMethod, actionButton
|
|
|
114
132
|
}, [children, secret, hasSecret, secretPlaceholder]);
|
|
115
133
|
const code = showSecret ? codeWithSecret : children;
|
|
116
134
|
const showBashPrefixes = language === 'bash';
|
|
117
|
-
return (_jsxs(OneLineCodeWrapper, { "$httpMethod": httpMethod, "$fullWidth": fullWidth, "$showBashPrefixes": showBashPrefixes, "$disabled": disabled, ...rest, children: [_jsxs("div", { className: oneLineCodeClassNames.gradientWrapper, children: [_jsxs("div", { className: oneLineCodeClassNames.scrollableWrapper, children: [httpMethod && (_jsx(Text, { className: oneLineCodeClassNames.methodChip, as: 'div', children: httpMethod })), _jsx(
|
|
135
|
+
return (_jsxs(OneLineCodeWrapper, { "$httpMethod": httpMethod, "$fullWidth": fullWidth, "$showBashPrefixes": showBashPrefixes, "$disabled": disabled, ...rest, children: [_jsxs("div", { className: oneLineCodeClassNames.gradientWrapper, children: [_jsxs("div", { className: oneLineCodeClassNames.scrollableWrapper, children: [httpMethod && (_jsx(Text, { className: oneLineCodeClassNames.methodChip, as: 'div', children: httpMethod })), _jsx(SyntaxHighlighter, { language: language, size: size, wrapLines: true, children: code })] }), _jsx("div", { className: oneLineCodeClassNames.gradient })] }), _jsxs("div", { className: oneLineCodeClassNames.buttons, children: [hasSecret && (_jsx(ActionButton, { onClick: () => setShowSecret((prev) => !prev), "data-test": 'toggle-visibility-button', children: showSecret ? (_jsx(EyeOffIcon, { size: "16" })) : (_jsx(EyeIcon, { size: "16" })) })), !hideCopyButton && _jsx(CopyButton, { code: codeWithSecret }), !!onActionButtonClick && (_jsx(ActionButton, { onClick: onActionButtonClick, children: actionButtonLabel }))] })] }));
|
|
118
136
|
}
|
|
119
137
|
//# sourceMappingURL=one_line_code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one_line_code.js","sourceRoot":"","sources":["../../../../../src/components/code/one_line_code/one_line_code.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"one_line_code.js","sourceRoot":"","sources":["../../../../../src/components/code/one_line_code/one_line_code.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEtD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AAmB,IAAI,CACtB,KAAC,YAAY,IAAC,OAAO,EAAE,mBAAmB,YACrC,iBAAiB,GACP,CAClB,IACC,IACY,CACzB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SyntaxHighlighterProps as ReactSyntaxHighlighterProps } from 'react-syntax-highlighter';
|
|
2
|
+
import { type SharedTextProps } from '../text/index.js';
|
|
3
|
+
import type { SharedTextSize } from '../text/text_shared.js';
|
|
4
|
+
type SyntaxHighlighterProps = ReactSyntaxHighlighterProps & {
|
|
5
|
+
size: SharedTextSize;
|
|
6
|
+
};
|
|
7
|
+
export declare const SyntaxHighlighter: import("react").ForwardRefExoticComponent<Omit<SyntaxHighlighterProps, "ref"> & import("react").RefAttributes<HTMLPreElement>>;
|
|
8
|
+
export type SyntaxHighlighterBaseStylesWrapperProps = SharedTextProps & {
|
|
9
|
+
$fullWidth?: boolean;
|
|
10
|
+
$fullHeight?: string;
|
|
11
|
+
$showLineNumbers?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const SyntaxHighlighterBaseStylesWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box.js").BoxProps & import("react").RefAttributes<HTMLElement>>, any, SyntaxHighlighterBaseStylesWrapperProps, never>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=syntax_highlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax_highlighter.d.ts","sourceRoot":"","sources":["../../../../src/components/code/syntax_highlighter.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,IAAI,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAiCtG,OAAO,EAAE,KAAK,eAAe,EAAQ,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAoD7D,KAAK,sBAAsB,GAAG,2BAA2B,GAAG;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAErF,eAAO,MAAM,iBAAiB,gIAsB5B,CAAC;AAEH,MAAM,MAAM,uCAAuC,GAAG,eAAe,GAAG;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAA;AAED,eAAO,MAAM,kCAAkC,wNAY9C,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
5
|
+
import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash.js';
|
|
6
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
7
|
+
import dockerFile from 'react-syntax-highlighter/dist/esm/languages/prism/docker.js';
|
|
8
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
9
|
+
import http from 'react-syntax-highlighter/dist/esm/languages/prism/http.js';
|
|
10
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
11
|
+
import js from 'react-syntax-highlighter/dist/esm/languages/prism/javascript.js';
|
|
12
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
13
|
+
import json from 'react-syntax-highlighter/dist/esm/languages/prism/json.js';
|
|
14
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
15
|
+
import html from 'react-syntax-highlighter/dist/esm/languages/prism/markup.js';
|
|
16
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
17
|
+
import python from 'react-syntax-highlighter/dist/esm/languages/prism/python.js';
|
|
18
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
19
|
+
import ts from 'react-syntax-highlighter/dist/esm/languages/prism/typescript.js';
|
|
20
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
21
|
+
import xml from 'react-syntax-highlighter/dist/esm/languages/prism/xml-doc.js';
|
|
22
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
23
|
+
import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml.js';
|
|
24
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
25
|
+
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
|
|
26
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
27
|
+
import dark from 'react-syntax-highlighter/dist/esm/styles/prism/night-owl.js';
|
|
28
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
29
|
+
import light from 'react-syntax-highlighter/dist/esm/styles/prism/prism.js';
|
|
30
|
+
/* tslint:enable */
|
|
31
|
+
import styled, { css } from 'styled-components';
|
|
32
|
+
import { theme } from '../../design_system/theme.js';
|
|
33
|
+
import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
|
|
34
|
+
import { Box } from '../box.js';
|
|
35
|
+
import { Text } from '../text/index.js';
|
|
36
|
+
ReactSyntaxHighlighter.registerLanguage('typescript', ts);
|
|
37
|
+
ReactSyntaxHighlighter.registerLanguage('javascript', js);
|
|
38
|
+
ReactSyntaxHighlighter.registerLanguage('json', json);
|
|
39
|
+
ReactSyntaxHighlighter.registerLanguage('bash', bash);
|
|
40
|
+
ReactSyntaxHighlighter.registerLanguage('docker', dockerFile);
|
|
41
|
+
ReactSyntaxHighlighter.registerLanguage('html', html);
|
|
42
|
+
ReactSyntaxHighlighter.registerLanguage('xml', xml);
|
|
43
|
+
ReactSyntaxHighlighter.registerLanguage('yaml', yaml);
|
|
44
|
+
ReactSyntaxHighlighter.registerLanguage('python', python);
|
|
45
|
+
ReactSyntaxHighlighter.registerLanguage('http', http);
|
|
46
|
+
ReactSyntaxHighlighter.registerLanguage('jsonp', json);
|
|
47
|
+
ReactSyntaxHighlighter.registerLanguage('jsonl', json);
|
|
48
|
+
ReactSyntaxHighlighter.registerLanguage('rss', xml);
|
|
49
|
+
const StyledPre = styled(Text) `
|
|
50
|
+
width: 100%;
|
|
51
|
+
position: relative;
|
|
52
|
+
|
|
53
|
+
*,
|
|
54
|
+
*::before,
|
|
55
|
+
*::after {
|
|
56
|
+
text-shadow: none !important;
|
|
57
|
+
font-style: normal !important;
|
|
58
|
+
font-family: inherit !important;
|
|
59
|
+
font-size: inherit !important;
|
|
60
|
+
font-weight: inherit !important;
|
|
61
|
+
line-height: inherit !important;
|
|
62
|
+
background-color: transparent !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
code {
|
|
66
|
+
min-width: 100%;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
vertical-align: middle;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
// Syntax highlighter uses inline style a lot which makes it hard to override them. To do so, we make the library not
|
|
73
|
+
// use styles that we wish to set on our own (font-based styles, spacing, background, ...),
|
|
74
|
+
const inlineCssReset = {
|
|
75
|
+
fontFamily: undefined,
|
|
76
|
+
fontSize: undefined,
|
|
77
|
+
fontWeight: undefined,
|
|
78
|
+
lineHeight: undefined,
|
|
79
|
+
background: undefined,
|
|
80
|
+
margin: undefined,
|
|
81
|
+
padding: undefined,
|
|
82
|
+
};
|
|
83
|
+
export const SyntaxHighlighter = forwardRef(({ size, children, ...rest }, ref) => {
|
|
84
|
+
const { uiTheme } = useSharedUiDependencies();
|
|
85
|
+
const PreTag = (preProps) => {
|
|
86
|
+
return _jsx(StyledPre, { ...preProps, size: size, forwardedAs: 'pre', type: 'code', ref: ref });
|
|
87
|
+
};
|
|
88
|
+
return (_jsx(ReactSyntaxHighlighter, { PreTag: PreTag, customStyle: inlineCssReset, className: "CodePre", style: uiTheme === 'DARK' ? dark : light, ...rest, children: children }));
|
|
89
|
+
});
|
|
90
|
+
export const SyntaxHighlighterBaseStylesWrapper = styled(Box) `
|
|
91
|
+
background-color: ${theme.color.neutral.backgroundMuted} !important;
|
|
92
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
93
|
+
border-radius: ${theme.radius.radius12};
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
|
|
96
|
+
width: 100%;
|
|
97
|
+
${({ $fullWidth }) => !$fullWidth && css `max-width: 860px;`}
|
|
98
|
+
${({ $fullHeight }) => !$fullHeight && css `max-height: 600px;`}
|
|
99
|
+
|
|
100
|
+
background-color: transparent;
|
|
101
|
+
position: relative;
|
|
102
|
+
`;
|
|
103
|
+
//# sourceMappingURL=syntax_highlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax_highlighter.js","sourceRoot":"","sources":["../../../../src/components/code/syntax_highlighter.tsx"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,qEAAqE;AACrE,OAAO,IAAI,MAAM,2DAA2D,CAAC;AAC7E,qEAAqE;AACrE,OAAO,UAAU,MAAM,6DAA6D,CAAC;AACrF,qEAAqE;AACrE,OAAO,IAAI,MAAM,2DAA2D,CAAC;AAC7E,qEAAqE;AACrE,OAAO,EAAE,MAAM,iEAAiE,CAAC;AACjF,qEAAqE;AACrE,OAAO,IAAI,MAAM,2DAA2D,CAAC;AAC7E,qEAAqE;AACrE,OAAO,IAAI,MAAM,6DAA6D,CAAC;AAC/E,qEAAqE;AACrE,OAAO,MAAM,MAAM,6DAA6D,CAAC;AACjF,qEAAqE;AACrE,OAAO,EAAE,MAAM,iEAAiE,CAAC;AACjF,qEAAqE;AACrE,OAAO,GAAG,MAAM,8DAA8D,CAAC;AAC/E,qEAAqE;AACrE,OAAO,IAAI,MAAM,2DAA2D,CAAC;AAC7E,qEAAqE;AACrE,OAAO,sBAAsB,MAAM,kDAAkD,CAAC;AACtF,qEAAqE;AACrE,OAAO,IAAI,MAAM,6DAA6D,CAAC;AAC/E,qEAAqE;AACrE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,mBAAmB;AACnB,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,C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