@apify/ui-library 0.71.1-featcolortokens-178953.56 → 0.71.1-featcolortokens-178953.58

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.
Files changed (98) hide show
  1. package/dist/tsconfig.build.tsbuildinfo +1 -0
  2. package/package.json +7 -5
  3. package/.stylelintrc +0 -12
  4. package/CHANGELOG.md +0 -3334
  5. package/CODEOWNERS +0 -7
  6. package/eslint.config.mjs +0 -44
  7. package/src/codemods/generate_typograpy_tokens_files.mjs +0 -137
  8. package/src/components/action_link.tsx +0 -60
  9. package/src/components/actor_template_card.tsx +0 -116
  10. package/src/components/badge.tsx +0 -148
  11. package/src/components/banner.tsx +0 -94
  12. package/src/components/blog_article.tsx +0 -85
  13. package/src/components/box.tsx +0 -127
  14. package/src/components/button.tsx +0 -305
  15. package/src/components/chip.tsx +0 -128
  16. package/src/components/code/action_button.tsx +0 -96
  17. package/src/components/code/code_block/code_block.styled.tsx +0 -180
  18. package/src/components/code/code_block/code_block.tsx +0 -224
  19. package/src/components/code/code_block/code_block_with_tabs.tsx +0 -257
  20. package/src/components/code/code_block/utils.tsx +0 -67
  21. package/src/components/code/index.ts +0 -5
  22. package/src/components/code/inline_code/inline_code.tsx +0 -62
  23. package/src/components/code/one_line_code/one_line_code.tsx +0 -228
  24. package/src/components/code/prism_highlighter.tsx +0 -180
  25. package/src/components/color_wheel_gradient.tsx +0 -31
  26. package/src/components/floating/index.ts +0 -3
  27. package/src/components/floating/menu.tsx +0 -189
  28. package/src/components/floating/menu_common.tsx +0 -31
  29. package/src/components/floating/menu_components.tsx +0 -99
  30. package/src/components/image.tsx +0 -24
  31. package/src/components/index.ts +0 -22
  32. package/src/components/link.tsx +0 -114
  33. package/src/components/message.tsx +0 -153
  34. package/src/components/rating.tsx +0 -106
  35. package/src/components/readme_renderer/index.ts +0 -3
  36. package/src/components/readme_renderer/pythonize_value.ts +0 -76
  37. package/src/components/readme_renderer/table_of_contents.tsx +0 -272
  38. package/src/components/readme_renderer/utils.tsx +0 -46
  39. package/src/components/simple_markdown/index.ts +0 -2
  40. package/src/components/simple_markdown/simple_markdown.tsx +0 -214
  41. package/src/components/simple_markdown/simple_markdown_components.tsx +0 -293
  42. package/src/components/tabs/index.ts +0 -2
  43. package/src/components/tabs/tab.tsx +0 -217
  44. package/src/components/tabs/tabs.tsx +0 -169
  45. package/src/components/tag.tsx +0 -196
  46. package/src/components/text/heading_content.tsx +0 -56
  47. package/src/components/text/heading_marketing.tsx +0 -55
  48. package/src/components/text/heading_shared.tsx +0 -55
  49. package/src/components/text/index.ts +0 -19
  50. package/src/components/text/text_base.tsx +0 -52
  51. package/src/components/text/text_content.tsx +0 -104
  52. package/src/components/text/text_marketing.tsx +0 -152
  53. package/src/components/text/text_shared.tsx +0 -95
  54. package/src/components/tile/horizontal_tile.tsx +0 -77
  55. package/src/components/tile/index.ts +0 -2
  56. package/src/components/tile/shared.ts +0 -27
  57. package/src/components/tile/vertical_tile.tsx +0 -59
  58. package/src/components/to_consolidate/card.tsx +0 -141
  59. package/src/components/to_consolidate/index.ts +0 -4
  60. package/src/components/to_consolidate/markdown.tsx +0 -609
  61. package/src/components/to_consolidate/pagination.tsx +0 -136
  62. package/src/components/to_consolidate/tab_number_chip.tsx +0 -31
  63. package/src/design_system/colors/build_color_tokens.js +0 -175
  64. package/src/design_system/colors/figma_color_tokens.dark.json +0 -886
  65. package/src/design_system/colors/figma_color_tokens.light.json +0 -886
  66. package/src/design_system/colors/generated/colors_theme.dark.ts +0 -110
  67. package/src/design_system/colors/generated/colors_theme.light.ts +0 -110
  68. package/src/design_system/colors/generated/dark.ts +0 -147
  69. package/src/design_system/colors/generated/light.ts +0 -147
  70. package/src/design_system/colors/generated/palette.dark.ts +0 -74
  71. package/src/design_system/colors/generated/palette.light.ts +0 -74
  72. package/src/design_system/colors/generated/properties_theme.ts +0 -179
  73. package/src/design_system/colors/index.ts +0 -7
  74. package/src/design_system/colors_theme.ts +0 -213
  75. package/src/design_system/properties_theme.ts +0 -453
  76. package/src/design_system/supernova_typography_tokens.json +0 -657
  77. package/src/design_system/theme.ts +0 -25
  78. package/src/design_system/tokens/index.ts +0 -5
  79. package/src/design_system/tokens/layouts.ts +0 -29
  80. package/src/design_system/tokens/radiuses.ts +0 -22
  81. package/src/design_system/tokens/shadows.ts +0 -22
  82. package/src/design_system/tokens/spaces.ts +0 -15
  83. package/src/design_system/tokens/transitions.ts +0 -19
  84. package/src/design_system/typography_theme.ts +0 -197
  85. package/src/index.ts +0 -8
  86. package/src/type_utils.ts +0 -7
  87. package/src/ui_dependency_provider.tsx +0 -58
  88. package/src/utils/copy_to_clipboard.ts +0 -24
  89. package/src/utils/image_color.ts +0 -42
  90. package/src/utils/index.ts +0 -4
  91. package/src/utils/resize_observer.ts +0 -18
  92. package/src/utils/sanitization.ts +0 -14
  93. package/tsconfig.build.json +0 -17
  94. package/tsconfig.json +0 -10
  95. /package/{src/design_system/colors/generated → style/colors}/dark.scss +0 -0
  96. /package/{src/design_system/colors/generated → style/colors}/light.scss +0 -0
  97. /package/{src/design_system/colors/generated → style/colors}/palette.dark.scss +0 -0
  98. /package/{src/design_system/colors/generated → style/colors}/palette.light.scss +0 -0
@@ -1,67 +0,0 @@
1
- import type { ReactNode } from 'react';
2
-
3
- import { theme } from '../../../design_system/theme.js';
4
- import { CodeHighlighterLineBashPrefix, CodeHighlighterLinePrefix } from '../prism_highlighter.js';
5
-
6
- // input: [2, 4, 5, 6, 8, 10, 11, 12]
7
- // returns string indicating what type of line it is (bashStartCommand, bashCommand, bashEmptyLine)
8
- // commands start -> bashStartCommand
9
- // every next line after command start until next command start or empty line -> bashCommand
10
- export const getBashLinePrefixes = (
11
- code: string,
12
- bashCommandsStart: number[] = [],
13
- isOneLine?: boolean) => {
14
- const lines = code.split('\n').map((line) => line.trim());
15
-
16
- const bashLinePrefixesArray = lines.map((line, i) => {
17
- const isEmptyLine = line.startsWith('#') || !line;
18
-
19
- // by default each line that is not empty or comment is a command start
20
- if (bashCommandsStart.length === 0) {
21
- return isEmptyLine ? (
22
- <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} />
23
- ) : (
24
- <CodeHighlighterLineBashPrefix $isOneLine={isOneLine} color={theme.color.lavender.base}>$</CodeHighlighterLineBashPrefix>
25
- );
26
- }
27
-
28
- if (bashCommandsStart.includes(i + 1)) {
29
- return (
30
- <CodeHighlighterLineBashPrefix
31
- $isOneLine={isOneLine}
32
- color={theme.color.lavender.base}
33
- key={`code-highlighter-line-bash-prefix-${i}`}
34
- >$</CodeHighlighterLineBashPrefix>
35
- );
36
- }
37
-
38
- if (isEmptyLine) {
39
- return (
40
- <CodeHighlighterLineBashPrefix
41
- $isOneLine={isOneLine}
42
- key={`code-highlighter-line-bash-prefix-${i}`}
43
- />
44
- );
45
- }
46
-
47
- return (
48
- <CodeHighlighterLineBashPrefix
49
- $isOneLine={isOneLine}
50
- color={theme.color.lavender.base}
51
- key={`code-highlighter-line-bash-prefix-${i}`}
52
- >&lt;</CodeHighlighterLineBashPrefix>
53
- );
54
- });
55
-
56
- return Object.fromEntries(bashLinePrefixesArray.map((linePrefix, i) => [i + 1, linePrefix]));
57
- };
58
-
59
- export const getNumberLinePrefixes = (code: string): Record<number, ReactNode> => {
60
- const numberOfLines = code.split('\n').length;
61
- const numbersArray = Array.from({ length: numberOfLines }, (_, i) => i + 1);
62
-
63
- return Object.fromEntries(numbersArray.map((number) => [
64
- number,
65
- <CodeHighlighterLinePrefix key={`code-highlighter-line-prefix-${number}`}>{number}</CodeHighlighterLinePrefix>,
66
- ]));
67
- };
@@ -1,5 +0,0 @@
1
- export * from './code_block/code_block.js';
2
- export * from './code_block/code_block_with_tabs.js';
3
- export * from './one_line_code/one_line_code.js';
4
- export * from './inline_code/inline_code.js';
5
- export * from './prism_highlighter.js';
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import styled, { css } from 'styled-components';
3
-
4
- import { CheckIcon, CopyIcon } from '@apify/ui-icons';
5
-
6
- import { theme } from '../../../design_system/theme.js';
7
- import { useCopyToClipboard } from '../../../utils/copy_to_clipboard.js';
8
- import type { RegularBoxProps } from '../../box.js';
9
- import { Text } from '../../text/index.js';
10
- import type { SharedTextSize } from '../../text/text_shared.js';
11
-
12
- // TODO: We should not need to export these once we consolidate Markdown
13
- export const inlineCodeStyles = css`
14
- width: fit-content;
15
- padding: ${theme.space.space2} 0.6rem;
16
- background-color: ${theme.color.neutral.backgroundMuted};
17
- border-radius: ${theme.radius.radius8};
18
- border: 1px solid ${theme.color.neutral.border};
19
- `;
20
-
21
- const CopyButtonWrapper = styled.div`
22
- display: inline-flex;
23
- cursor: pointer;
24
- vertical-align: text-top;
25
- margin-left: ${theme.space.space4};
26
- `;
27
-
28
- const CopyButton: React.FC<{ text: string }> = ({ text }) => {
29
- const [isCopied, copyToClipboard] = useCopyToClipboard({ text });
30
- return <CopyButtonWrapper role='button' onClick={copyToClipboard} title='Copy to clipboard'>
31
- {isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
32
- </CopyButtonWrapper>;
33
- };
34
-
35
- const Wrapper = styled.span`
36
- code {
37
- ${inlineCodeStyles}
38
- }
39
- `;
40
-
41
- export type InlineCodeProps = RegularBoxProps & {
42
- children: React.ReactNode,
43
- size?: SharedTextSize,
44
- withCopyButton?: boolean,
45
- }
46
-
47
- // This might be just a Chip component
48
- export const InlineCode: React.FC<InlineCodeProps> = ({
49
- children,
50
- size,
51
- withCopyButton,
52
- ...props
53
- }) => <Wrapper {...props}>
54
- <Text
55
- type="code"
56
- as="code"
57
- size={size}
58
- >
59
- {children}
60
- {withCopyButton && <CopyButton text={children?.toString() ?? ''} />}
61
- </Text>
62
- </Wrapper>;
@@ -1,228 +0,0 @@
1
- import { useMemo, useState } from 'react';
2
- import styled, { css } from 'styled-components';
3
-
4
- import { EyeIcon, EyeOffIcon } from '@apify/ui-icons';
5
-
6
- import { theme } from '../../../design_system/theme.js';
7
- import type { BoxProps } from '../../box.js';
8
- import { Text } from '../../text/index.js';
9
- import type { SharedTextSize } from '../../text/text_shared.js';
10
- import { ActionButton, CopyButton } from '../action_button.js';
11
- import type { SyntaxHighlighterBaseStylesWrapperProps } from '../code_block/code_block.styled.js';
12
- import { SyntaxHighlighterBaseStylesWrapper } from '../code_block/code_block.styled.js';
13
- import { getBashLinePrefixes } from '../code_block/utils.js';
14
- import { PrismSyntaxHighlighter } from '../prism_highlighter.js';
15
-
16
- export const oneLineCodeClassNames = {
17
- gradientWrapper: 'OneLineCode-GradientWrapper',
18
- scrollableWrapper: 'OneLineCode-ScrollableWrapper',
19
- methodChip: 'OneLineCode-MethodChip',
20
- gradient: 'OneLineCode-Gradient',
21
- buttons: 'OneLineCode-Buttons',
22
- };
23
-
24
- type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'PATCH';
25
- type ThemeType = keyof Pick<
26
- (typeof theme)['color'],
27
- 'primary' | 'success' | 'warning' | 'danger' | 'neutral'
28
- >;
29
-
30
- const HTML_METHOD_CHIP_STYLES: Record<HttpMethod, ThemeType> = {
31
- GET: 'primary',
32
- POST: 'success',
33
- PUT: 'warning',
34
- DELETE: 'danger',
35
- HEAD: 'neutral',
36
- PATCH: 'neutral',
37
- };
38
-
39
- function getChipStyles(httpMethod: HttpMethod) {
40
- const styles = theme.color[HTML_METHOD_CHIP_STYLES[httpMethod]];
41
- return css`
42
- background-color: ${styles.chipBackground};
43
- color: ${'chipText' in styles ? styles.chipText : styles.text};
44
- `;
45
- }
46
-
47
- type OneLineCodeWrapperProps = SyntaxHighlighterBaseStylesWrapperProps & {
48
- $httpMethod?: HttpMethod;
49
- $fitContent?: boolean;
50
- $showBashPrefixes?: boolean;
51
- $disabled?: boolean;
52
- }
53
-
54
- const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<OneLineCodeWrapperProps>`
55
- display: flex;
56
- padding-right: ${theme.space.space16} !important;
57
- ${({ $fitContent }) => $fitContent && css`
58
- width: fit-content;
59
- `}
60
-
61
- ${({ $disabled }) => $disabled && css`
62
- opacity: 0.5;
63
- cursor: not-allowed;
64
- `}
65
-
66
- height: 4.6rem;
67
-
68
- .${oneLineCodeClassNames.buttons} {
69
- display: flex;
70
- align-items: center;
71
- gap: ${theme.space.space8};
72
- }
73
-
74
- .${oneLineCodeClassNames.methodChip} {
75
- padding: 0 ${theme.space.space4};
76
- border-radius: ${theme.radius.radius6};
77
- height: 2.4rem;
78
- ${({ $httpMethod }) => $httpMethod && getChipStyles($httpMethod)}
79
- display: flex;
80
- align-items: center;
81
- }
82
-
83
- .${oneLineCodeClassNames.gradientWrapper} {
84
- position: relative;
85
- flex: 1;
86
- min-width: 0;
87
- display: flex;
88
-
89
- .${oneLineCodeClassNames.gradient} {
90
- position: absolute;
91
- right: 0;
92
- top: 0;
93
- bottom: 0;
94
- width: 4rem;
95
- z-index: 5;
96
- background: linear-gradient(
97
- to right,
98
- transparent,
99
- ${theme.color.neutral.backgroundMuted} 3rem
100
- );
101
- }
102
- }
103
-
104
- .${oneLineCodeClassNames.scrollableWrapper} {
105
- flex: 1;
106
- overflow-x: auto;
107
- overflow-y: hidden;
108
- display: flex;
109
- align-items: center;
110
- gap: ${theme.space.space16};
111
- padding: 0 ${theme.space.space8} !important;
112
- margin-left: ${theme.space.space8} !important;
113
- height: 100%;
114
-
115
- scrollbar-width: thin;
116
- scrollbar-color: ${theme.color.neutral.border} transparent;
117
-
118
-
119
- pre {
120
- display: flex;
121
- flex: 1;
122
- align-items: center;
123
- height: 100%;
124
-
125
- code {
126
- height: 100%;
127
- display: flex;
128
- align-items: center;
129
-
130
- & > div {
131
- padding-right: ${theme.space.space16};
132
- }
133
- }
134
- }
135
- }
136
- `;
137
-
138
- export type OneLineCodeProps = BoxProps & {
139
- children: string;
140
- language?: string;
141
- size?: SharedTextSize;
142
- httpMethod?: HttpMethod;
143
- actionButtonLabel?: string;
144
- onActionButtonClick?: () => Promise<void> | void;
145
- fullWidth?: boolean;
146
- secretPlaceholder?: string;
147
- secret?: string;
148
- disabled?: boolean;
149
- hideCopyButton?: boolean;
150
- }
151
-
152
- export function OneLineCode({
153
- children,
154
- language,
155
- size,
156
- httpMethod,
157
- actionButtonLabel,
158
- onActionButtonClick,
159
- fullWidth,
160
- secretPlaceholder = '***',
161
- secret,
162
- disabled,
163
- hideCopyButton,
164
- ...rest
165
- }: OneLineCodeProps) {
166
- const hasSecret = secret !== undefined;
167
- const [showSecret, setShowSecret] = useState(false);
168
- const codeWithSecret = useMemo(() => {
169
- if (!hasSecret) return children;
170
- return children.replace(secretPlaceholder, secret);
171
- }, [children, secret, hasSecret, secretPlaceholder]);
172
- const code = showSecret ? codeWithSecret : children;
173
-
174
- const showBashPrefixes = language === 'bash';
175
-
176
- const linePrefixes = useMemo(
177
- () => (showBashPrefixes ? getBashLinePrefixes(code, [1], true) : {}),
178
- [showBashPrefixes, code],
179
- );
180
-
181
- return (
182
- <OneLineCodeWrapper
183
- $httpMethod={httpMethod}
184
- $fullWidth={fullWidth}
185
- $showBashPrefixes={showBashPrefixes}
186
- $disabled={disabled}
187
- {...rest}
188
- >
189
- <div className={oneLineCodeClassNames.gradientWrapper}>
190
- <div className={oneLineCodeClassNames.scrollableWrapper}>
191
- {httpMethod && (
192
- <Text className={oneLineCodeClassNames.methodChip} as='div'>
193
- {httpMethod}
194
- </Text>
195
- )}
196
- <PrismSyntaxHighlighter
197
- language={language}
198
- size={size}
199
- linePrefixes={linePrefixes}
200
- code={code}
201
- isSingleLine={true}
202
- />
203
- </div>
204
- <div className={oneLineCodeClassNames.gradient} />
205
- </div>
206
- <div className={oneLineCodeClassNames.buttons}>
207
- {hasSecret && (
208
- <ActionButton
209
- onClick={() => setShowSecret((prev) => !prev)}
210
- data-test='toggle-visibility-button'
211
- >
212
- {showSecret ? (
213
- <EyeOffIcon size="16" />
214
- ) : (
215
- <EyeIcon size="16" />
216
- )}
217
- </ActionButton>
218
- )}
219
- {!hideCopyButton && <CopyButton code={codeWithSecret} />}
220
- {!!onActionButtonClick && (
221
- <ActionButton onClick={onActionButtonClick}>
222
- {actionButtonLabel}
223
- </ActionButton>
224
- )}
225
- </div>
226
- </OneLineCodeWrapper >
227
- );
228
- }
@@ -1,180 +0,0 @@
1
- import clsx from 'clsx';
2
- import _ from 'lodash';
3
- import type { HighlightProps } from 'prism-react-renderer';
4
- import { Highlight, Prism, themes } from 'prism-react-renderer';
5
- import type { ReactNode } from 'react';
6
- import { forwardRef, useRef } from 'react';
7
- import styled, { css } from 'styled-components';
8
-
9
- import { theme } from '../../design_system/theme.js';
10
- import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
11
- import { Text } from '../text/index.js';
12
- import type { SharedTextSize } from '../text/text_shared.js';
13
-
14
- (typeof global !== 'undefined' ? global : window).Prism = Prism;
15
-
16
- const HIGHLIGHT_BACKGROUND_COLOR = 'rgba(22, 114, 235, 0.05)';
17
-
18
- const loadLanguages = async () => {
19
- await Promise.all([
20
- // @ts-expect-error The library is badly typed and does not export the type
21
- import('prismjs/components/prism-bash.js'),
22
- // @ts-expect-error The library is badly typed and does not export the type
23
- import('prismjs/components/prism-rust.js'),
24
- // @ts-expect-error The library is badly typed and does not export the type
25
- import('prismjs/components/prism-bash.js'),
26
- // @ts-expect-error The library is badly typed and does not export the type
27
- import('prismjs/components/prism-docker.js'),
28
- // @ts-expect-error The library is badly typed and does not export the type
29
- import('prismjs/components/prism-http.js'),
30
- // @ts-expect-error The library is badly typed and does not export the type
31
- import('prismjs/components/prism-javascript.js'),
32
- // @ts-expect-error The library is badly typed and does not export the type
33
- import('prismjs/components/prism-json.js'),
34
- // @ts-expect-error The library is badly typed and does not export the type
35
- import('prismjs/components/prism-markup.js'),
36
- // @ts-expect-error The library is badly typed and does not export the type
37
- import('prismjs/components/prism-python.js'),
38
- // @ts-expect-error The library is badly typed and does not export the type
39
- import('prismjs/components/prism-typescript.js'),
40
- // @ts-expect-error The library is badly typed and does not export the type
41
- import('prismjs/components/prism-xml-doc.js'),
42
- // @ts-expect-error The library is badly typed and does not export the type
43
- import('prismjs/components/prism-yaml.js'),
44
- ]);
45
- };
46
-
47
- void loadLanguages();
48
-
49
- type StyledPreProps = {
50
- $hasLinePrefixes: boolean,
51
- $isSingleLine: boolean
52
- };
53
-
54
- const StyledPre = styled.pre<StyledPreProps>`
55
- width: 100%;
56
- position: relative;
57
- overflow: auto;
58
- z-index: 2;
59
- padding: ${({ $isSingleLine }) => ($isSingleLine ? 0 : `${theme.space.space16} 0`)};
60
- margin: 0;
61
-
62
- code {
63
- min-width: 100%;
64
- display: inline-block;
65
- vertical-align: middle;
66
-
67
- *,
68
- *::before,
69
- *::after {
70
- text-shadow: none !important;
71
- font-style: normal !important;
72
- font-family: inherit !important;
73
- font-size: inherit !important;
74
- font-weight: inherit !important;
75
- line-height: inherit !important;
76
- background-color: transparent !important;
77
- }
78
-
79
- & > div {
80
- display: block;
81
-
82
- &.highlighted {
83
- background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
84
- border-left: 6px solid ${theme.color.neutral.border} !important;
85
- padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
86
- }
87
-
88
- ${({ $isSingleLine }) => !$isSingleLine && css<{$hasLinePrefixes: boolean}>`
89
- &:hover {
90
- background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
91
- border-left: 6px solid ${theme.color.neutral.border} !important;
92
- padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
93
- }
94
- `}
95
-
96
- ${({ $isSingleLine }) => ($isSingleLine ? css<StyledPreProps>`
97
- white-space: nowrap;
98
- vertical-align: text-top;
99
- ` : css<StyledPreProps>`
100
- padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? theme.space.space8 : theme.space.space16)};
101
- padding-right: ${theme.space.space16};
102
-
103
- &:hover {
104
- background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
105
- border-left: 6px solid ${theme.color.neutral.border} !important;
106
- padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
107
- }
108
- `)}
109
- }
110
- }
111
- `;
112
-
113
- export const CodeHighlighterLinePrefix = styled(Text).attrs({ as: 'span' })`
114
- display: inline-block;
115
- margin-right: ${theme.space.space16};
116
- text-align: right;
117
- min-width: ${theme.space.space24};
118
- color: ${({ color }) => color || theme.color.neutral.textSubtle};
119
- user-select: none;
120
- -webkit-user-select: none;
121
- `;
122
-
123
- export const CodeHighlighterLineBashPrefix = styled(CodeHighlighterLinePrefix)<{ $isOneLine?: boolean }>`
124
- min-width: ${({ $isOneLine }) => ($isOneLine ? 'unset' : theme.space.space16)} !important;
125
- `;
126
-
127
- type SyntaxHighlighterProps = Omit<HighlightProps, 'children' | 'language'> & {
128
- size?: SharedTextSize,
129
- linePrefixes?: Record<string, ReactNode>,
130
- highlightLines?: number[],
131
- language?: string,
132
- className?: string,
133
- isSingleLine: boolean,
134
- };
135
-
136
- export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlighterProps>(({
137
- size = 'regular',
138
- linePrefixes = {},
139
- highlightLines = [],
140
- language = 'javascript',
141
- className,
142
- isSingleLine,
143
- ...rest
144
- }, ref) => {
145
- const { uiTheme } = useSharedUiDependencies();
146
- const hasLinePrefixes = !_.isEmpty(linePrefixes);
147
- const highlightedLinesObject = useRef<Record<number, boolean>>(Object.fromEntries(highlightLines.map((e) => [e, true])));
148
-
149
- return (
150
- <Highlight
151
- theme={uiTheme === 'DARK' ? themes.nightOwl : themes.oneLight}
152
- language={language}
153
- {...rest}
154
- >
155
- {({ className: prismClassName, tokens, getLineProps, getTokenProps }) => (
156
- <StyledPre
157
- className={clsx(className, prismClassName)}
158
- $hasLinePrefixes={hasLinePrefixes}
159
- $isSingleLine={isSingleLine}
160
- ref={ref}
161
- >
162
- <Text
163
- size={size}
164
- type='code'
165
- as='code'
166
- >
167
- {tokens.map((line, i) => (
168
- <div key={i} {...getLineProps({ line, className: highlightedLinesObject.current[i + 1] ? 'highlighted' : '' })}>
169
- {hasLinePrefixes && (linePrefixes[i + 1] || <CodeHighlighterLinePrefix />)}
170
- {line.map((token, key) => (
171
- <span key={key} {...getTokenProps({ token })} />
172
- ))}
173
- </div>
174
- ))}
175
- </Text>
176
- </StyledPre>
177
- )}
178
- </Highlight>
179
- );
180
- });
@@ -1,31 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export interface ColorWheelGradientProps {
4
- translateX?: number,
5
- translateY?: number,
6
- rotation?: number,
7
- radius?: number,
8
- blurSize?: number,
9
- }
10
-
11
- export const ColorWheelGradient = styled.div<ColorWheelGradientProps>`${({ radius, rotation = 0, blurSize = 40, translateX = 0, translateY = 0 }) => `
12
- z-index: 1;
13
- position: absolute;
14
- width: ${radius ? `${radius}px` : 'auto'};
15
- height: ${radius ? `${radius}px` : 'auto'};
16
- transform-origin: center;
17
- transform: translate(${translateX}px, ${translateY}px) rotate(${rotation}deg);
18
-
19
- opacity: 0.30;
20
- background: conic-gradient(
21
- rgba(93, 133, 225, 0.99) 0deg,
22
- rgba(106, 20, 222, 0.99) 69deg,
23
- rgba(228, 68, 103, 0.99) 150deg,
24
- rgba(250, 129, 54, 0.99) 221deg,
25
- rgba(240, 178, 27, 0.99) 287deg,
26
- rgba(18, 150, 111, 0.99) 360deg
27
- );
28
-
29
- border-radius: 50%;
30
- filter: blur(${blurSize}px)
31
- `}`;
@@ -1,3 +0,0 @@
1
- export * from './menu.js';
2
- export * from './menu_components.js';
3
- export * from './menu_common.js';