@apify/ui-library 1.98.3 → 1.99.0
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/dist/src/components/code/one_light_theme.d.ts +3 -0
- package/dist/src/components/code/one_light_theme.d.ts.map +1 -0
- package/dist/src/components/code/one_light_theme.js +108 -0
- package/dist/src/components/code/one_light_theme.js.map +1 -0
- package/dist/src/components/code/prism_highlighter.d.ts.map +1 -1
- package/dist/src/components/code/prism_highlighter.js +4 -3
- package/dist/src/components/code/prism_highlighter.js.map +1 -1
- package/dist/src/components/code/prism_python.d.ts +1 -0
- package/dist/src/components/code/prism_python.d.ts.map +1 -0
- package/dist/src/components/code/prism_python.js +76 -0
- package/dist/src/components/code/prism_python.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/code/one_light_theme.ts +110 -0
- package/src/components/code/prism_highlighter.tsx +4 -3
- package/src/components/code/prism_python.ts +76 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.99.0",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"src",
|
|
65
65
|
"style"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "066d002719f4c6ed241b7394465ed7aa74eea1c8"
|
|
68
68
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { PrismTheme } from 'prism-react-renderer';
|
|
2
|
+
|
|
3
|
+
export const oneLightTheme: PrismTheme = {
|
|
4
|
+
plain: {
|
|
5
|
+
backgroundColor: 'hsl(230, 1%, 98%)',
|
|
6
|
+
color: 'hsl(230, 8%, 24%)',
|
|
7
|
+
},
|
|
8
|
+
styles: [
|
|
9
|
+
{
|
|
10
|
+
types: ['comment', 'prolog', 'cdata'],
|
|
11
|
+
style: {
|
|
12
|
+
color: 'hsl(230, 4%, 64%)',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
types: ['doctype', 'entity'],
|
|
17
|
+
style: {
|
|
18
|
+
color: 'hsl(230, 8%, 24%)',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
types: [
|
|
23
|
+
'attr-name',
|
|
24
|
+
'class-name',
|
|
25
|
+
'boolean',
|
|
26
|
+
'constant',
|
|
27
|
+
'number',
|
|
28
|
+
'atrule',
|
|
29
|
+
],
|
|
30
|
+
style: {
|
|
31
|
+
color: 'hsl(35, 99%, 36%)',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
types: ['keyword'],
|
|
36
|
+
style: {
|
|
37
|
+
color: 'hsl(301, 63%, 40%)',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
types: ['property', 'tag', 'symbol', 'deleted', 'important'],
|
|
43
|
+
style: {
|
|
44
|
+
color: 'hsl(5, 74%, 59%)',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
types: ['punctuation'],
|
|
49
|
+
style: {
|
|
50
|
+
color: 'hsl(230, 6%, 44%)',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
types: [
|
|
55
|
+
'selector',
|
|
56
|
+
'string',
|
|
57
|
+
'char',
|
|
58
|
+
'builtin',
|
|
59
|
+
'inserted',
|
|
60
|
+
'regex',
|
|
61
|
+
'attr-value',
|
|
62
|
+
],
|
|
63
|
+
style: {
|
|
64
|
+
color: 'hsl(119, 34%, 47%)',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
types: ['variable', 'operator', 'function'],
|
|
69
|
+
style: {
|
|
70
|
+
color: 'hsl(221, 87%, 60%)',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
types: ['url'],
|
|
75
|
+
style: {
|
|
76
|
+
color: 'hsl(198, 99%, 37%)',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
types: ['deleted'],
|
|
81
|
+
style: {
|
|
82
|
+
textDecorationLine: 'line-through',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
types: ['inserted'],
|
|
87
|
+
style: {
|
|
88
|
+
textDecorationLine: 'underline',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
types: ['italic'],
|
|
93
|
+
style: {
|
|
94
|
+
fontStyle: 'italic',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
types: ['important', 'bold'],
|
|
99
|
+
style: {
|
|
100
|
+
fontWeight: 'bold',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
types: ['important'],
|
|
105
|
+
style: {
|
|
106
|
+
color: 'hsl(230, 8%, 24%)',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
@@ -10,6 +10,7 @@ import { theme } from '../../design_system/theme.js';
|
|
|
10
10
|
import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
|
|
11
11
|
import { Text } from '../text/index.js';
|
|
12
12
|
import type { SharedTextSize } from '../text/text_shared.js';
|
|
13
|
+
import { oneLightTheme } from './one_light_theme.js';
|
|
13
14
|
|
|
14
15
|
(typeof global !== 'undefined' ? global : window).Prism = Prism;
|
|
15
16
|
|
|
@@ -34,13 +35,13 @@ const loadLanguages = async () => {
|
|
|
34
35
|
// @ts-expect-error The library is badly typed and does not export the type
|
|
35
36
|
import('prismjs/components/prism-markup.js'),
|
|
36
37
|
// @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
38
|
import('prismjs/components/prism-typescript.js'),
|
|
40
39
|
// @ts-expect-error The library is badly typed and does not export the type
|
|
41
40
|
import('prismjs/components/prism-xml-doc.js'),
|
|
42
41
|
// @ts-expect-error The library is badly typed and does not export the type
|
|
43
42
|
import('prismjs/components/prism-yaml.js'),
|
|
43
|
+
// @ts-expect-error The library is badly typed and does not export the type
|
|
44
|
+
import('./prism_python.js'),
|
|
44
45
|
]);
|
|
45
46
|
};
|
|
46
47
|
|
|
@@ -192,7 +193,7 @@ export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlight
|
|
|
192
193
|
|
|
193
194
|
return (
|
|
194
195
|
<Highlight
|
|
195
|
-
theme={uiTheme === 'DARK' ? themes.nightOwl :
|
|
196
|
+
theme={uiTheme === 'DARK' ? themes.nightOwl : oneLightTheme}
|
|
196
197
|
language={effectiveLanguage}
|
|
197
198
|
{...rest}
|
|
198
199
|
>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Prism.languages.python = {
|
|
2
|
+
comment: {
|
|
3
|
+
pattern: /(^|[^\\])#.*/,
|
|
4
|
+
lookbehind: true,
|
|
5
|
+
greedy: true,
|
|
6
|
+
},
|
|
7
|
+
// @ts-expect-error `prismjs` is badly typed
|
|
8
|
+
'string-interpolation': {
|
|
9
|
+
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
10
|
+
greedy: true,
|
|
11
|
+
inside: {
|
|
12
|
+
interpolation: {
|
|
13
|
+
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
14
|
+
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
15
|
+
lookbehind: true,
|
|
16
|
+
inside: {
|
|
17
|
+
'format-spec': {
|
|
18
|
+
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
19
|
+
lookbehind: true,
|
|
20
|
+
},
|
|
21
|
+
'conversion-option': {
|
|
22
|
+
pattern: //,
|
|
23
|
+
alias: 'punctuation',
|
|
24
|
+
},
|
|
25
|
+
rest: null,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
string: /[\s\S]+/,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
// this is missing in the official `prismjs` definition
|
|
32
|
+
'string-property': {
|
|
33
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
34
|
+
lookbehind: true,
|
|
35
|
+
greedy: true,
|
|
36
|
+
alias: 'property',
|
|
37
|
+
},
|
|
38
|
+
'triple-quoted-string': {
|
|
39
|
+
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
40
|
+
greedy: true,
|
|
41
|
+
alias: 'string',
|
|
42
|
+
},
|
|
43
|
+
string: {
|
|
44
|
+
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
45
|
+
greedy: true,
|
|
46
|
+
},
|
|
47
|
+
function: {
|
|
48
|
+
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
49
|
+
lookbehind: true,
|
|
50
|
+
},
|
|
51
|
+
'class-name': {
|
|
52
|
+
pattern: /(\bclass\s+)\w+/i,
|
|
53
|
+
lookbehind: true,
|
|
54
|
+
},
|
|
55
|
+
decorator: {
|
|
56
|
+
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
57
|
+
lookbehind: true,
|
|
58
|
+
alias: ['annotation', 'punctuation'],
|
|
59
|
+
inside: {
|
|
60
|
+
punctuation: /\./,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
// eslint-disable-next-line max-len
|
|
64
|
+
keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
65
|
+
// eslint-disable-next-line max-len
|
|
66
|
+
builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
67
|
+
boolean: /\b(?:False|None|True)\b/,
|
|
68
|
+
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
69
|
+
operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
70
|
+
punctuation: /[{}[\];(),.:]/,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// @ts-expect-error `prismjs` is badly typed
|
|
74
|
+
Prism.languages.python['string-interpolation'].inside.interpolation.inside.rest = Prism.languages.python;
|
|
75
|
+
|
|
76
|
+
Prism.languages.py = Prism.languages.python;
|