@master/css 2.0.0-rc.25 → 2.0.0-rc.27
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/common.cjs +124 -0
- package/dist/common.d.ts +22 -0
- package/dist/common.mjs +106 -0
- package/dist/config/functions.cjs +40 -41
- package/dist/config/functions.mjs +39 -40
- package/dist/config/index.cjs +7 -7
- package/dist/config/index.d.ts +12 -13
- package/dist/config/index.mjs +6 -6
- package/dist/config/queries.cjs +17 -0
- package/dist/config/queries.d.ts +22 -0
- package/dist/config/queries.mjs +15 -0
- package/dist/config/rules.cjs +964 -851
- package/dist/config/rules.d.ts +8 -5
- package/dist/config/rules.mjs +966 -852
- package/dist/config/selectors.cjs +0 -1
- package/dist/config/selectors.d.ts +0 -1
- package/dist/config/selectors.mjs +0 -1
- package/dist/config/{semantics.cjs → utilities.cjs} +2 -5
- package/dist/config/{semantics.d.ts → utilities.d.ts} +2 -5
- package/dist/config/{semantics.mjs → utilities.mjs} +2 -5
- package/dist/config/variables.mjs +2 -2
- package/dist/core.cjs +260 -195
- package/dist/core.d.ts +20 -16
- package/dist/core.mjs +258 -193
- package/dist/index.cjs +45 -15
- package/dist/index.d.ts +13 -3
- package/dist/index.mjs +15 -7
- package/dist/layer.cjs +25 -20
- package/dist/layer.d.ts +26 -9
- package/dist/layer.mjs +22 -19
- package/dist/rule.cjs +147 -125
- package/dist/rule.d.ts +58 -20
- package/dist/rule.mjs +147 -125
- package/dist/tokens/screen-sizes.cjs +2 -2
- package/dist/tokens/screen-sizes.mjs +2 -2
- package/dist/utils/are-rule-modes-equal.cjs +7 -0
- package/dist/utils/are-rule-modes-equal.d.ts +2 -0
- package/dist/utils/are-rule-modes-equal.mjs +5 -0
- package/dist/utils/are-rule-queries-equal.cjs +22 -0
- package/dist/utils/are-rule-queries-equal.d.ts +2 -0
- package/dist/utils/are-rule-queries-equal.mjs +20 -0
- package/dist/utils/are-rule-selectors-equal.cjs +29 -0
- package/dist/utils/are-rule-selectors-equal.d.ts +2 -0
- package/dist/utils/are-rule-selectors-equal.mjs +27 -0
- package/dist/utils/are-rule-states-equal.cjs +11 -0
- package/dist/utils/are-rule-states-equal.d.ts +2 -0
- package/dist/utils/are-rule-states-equal.mjs +9 -0
- package/dist/utils/are-rules-duplicated.cjs +17 -0
- package/dist/utils/are-rules-duplicated.d.ts +2 -0
- package/dist/utils/are-rules-duplicated.mjs +15 -0
- package/dist/utils/extend-config.cjs +27 -14
- package/dist/utils/extend-config.d.ts +1 -1
- package/dist/utils/extend-config.mjs +27 -14
- package/dist/utils/generate-css.cjs +13 -0
- package/dist/utils/generate-css.d.ts +2 -0
- package/dist/utils/generate-css.mjs +11 -0
- package/dist/utils/hex-to-rgb.cjs +1 -1
- package/dist/utils/hex-to-rgb.d.ts +1 -1
- package/dist/utils/hex-to-rgb.mjs +1 -1
- package/dist/utils/is-core-rule.cjs +9 -0
- package/dist/utils/is-core-rule.d.ts +1 -0
- package/dist/utils/is-core-rule.mjs +7 -0
- package/dist/{functions → utils}/reorder-for-readable-classes.cjs +12 -18
- package/dist/{functions → utils}/reorder-for-readable-classes.d.ts +1 -5
- package/dist/{functions → utils}/reorder-for-readable-classes.mjs +13 -19
- package/package.json +1 -1
- package/dist/config/media-queries.cjs +0 -7
- package/dist/config/media-queries.d.ts +0 -1
- package/dist/config/media-queries.mjs +0 -1
- package/dist/constants/base-unit-regex.cjs +0 -5
- package/dist/constants/base-unit-regex.d.ts +0 -1
- package/dist/constants/base-unit-regex.mjs +0 -3
- package/dist/constants/start-symbol.cjs +0 -10
- package/dist/constants/start-symbol.d.ts +0 -6
- package/dist/constants/start-symbol.mjs +0 -8
- package/dist/functions/transform-color-with-opacity.cjs +0 -9
- package/dist/functions/transform-color-with-opacity.d.ts +0 -1
- package/dist/functions/transform-color-with-opacity.mjs +0 -7
- package/dist/utils/concat-arrays.cjs +0 -12
- package/dist/utils/concat-arrays.d.ts +0 -1
- package/dist/utils/concat-arrays.mjs +0 -10
- package/dist/utils/get-type.cjs +0 -12
- package/dist/utils/get-type.d.ts +0 -7
- package/dist/utils/get-type.mjs +0 -10
- package/dist/utils/is-plain-object.cjs +0 -15
- package/dist/utils/is-plain-object.d.ts +0 -8
- package/dist/utils/is-plain-object.mjs +0 -13
- package/dist/utils/is-symbol.cjs +0 -14
- package/dist/utils/is-symbol.d.ts +0 -7
- package/dist/utils/is-symbol.mjs +0 -12
- package/dist/utils/rgb-to-hex.cjs +0 -7
- package/dist/utils/rgb-to-hex.d.ts +0 -1
- package/dist/utils/rgb-to-hex.mjs +0 -5
package/dist/common.cjs
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const VALUE_DELIMITERS = {
|
|
4
|
+
'(': ')',
|
|
5
|
+
'\'': '\'',
|
|
6
|
+
'"': '"',
|
|
7
|
+
'{': '}'
|
|
8
|
+
};
|
|
9
|
+
const BASE_UNIT_REGEX = /^([+-]?(?:\d+(?:\.?\d+)?|\.\d+))x$/m // 1x, 1.1x, -1x, -.1x
|
|
10
|
+
;
|
|
11
|
+
const TRANSITION_SIGN = '~';
|
|
12
|
+
const ANIMATION_SIGN = '@';
|
|
13
|
+
const SELECTOR_SIGNS = [
|
|
14
|
+
':',
|
|
15
|
+
'_',
|
|
16
|
+
'>',
|
|
17
|
+
'+',
|
|
18
|
+
'~'
|
|
19
|
+
];
|
|
20
|
+
const QUERY_COMPARISON_OPERATORS = [
|
|
21
|
+
'>',
|
|
22
|
+
'<',
|
|
23
|
+
'='
|
|
24
|
+
];
|
|
25
|
+
const QUERY_LOGICAL_OPERATORS = [
|
|
26
|
+
'&'
|
|
27
|
+
];
|
|
28
|
+
const SEPARATOR_SIGNS = [
|
|
29
|
+
',',
|
|
30
|
+
'|'
|
|
31
|
+
];
|
|
32
|
+
const DELIMITER_SIGN = '|';
|
|
33
|
+
const SEPARATOR_SIGN = ',';
|
|
34
|
+
const AT_SIGN = '@';
|
|
35
|
+
const VALUE_UNITS = [
|
|
36
|
+
'%',
|
|
37
|
+
'cm',
|
|
38
|
+
'mm',
|
|
39
|
+
'q',
|
|
40
|
+
'in',
|
|
41
|
+
'pt',
|
|
42
|
+
'pc',
|
|
43
|
+
'px',
|
|
44
|
+
'em',
|
|
45
|
+
'rem',
|
|
46
|
+
'ex',
|
|
47
|
+
'rex',
|
|
48
|
+
'cap',
|
|
49
|
+
'rcap',
|
|
50
|
+
'ch',
|
|
51
|
+
'rch',
|
|
52
|
+
'ic',
|
|
53
|
+
'ric',
|
|
54
|
+
'lh',
|
|
55
|
+
'rlh',
|
|
56
|
+
'vw',
|
|
57
|
+
'svw',
|
|
58
|
+
'lvw',
|
|
59
|
+
'dvw',
|
|
60
|
+
'vh',
|
|
61
|
+
'svh',
|
|
62
|
+
'lvh',
|
|
63
|
+
'dvh',
|
|
64
|
+
'vi',
|
|
65
|
+
'svi',
|
|
66
|
+
'lvi',
|
|
67
|
+
'dvi',
|
|
68
|
+
'vb',
|
|
69
|
+
'svb',
|
|
70
|
+
'lvb',
|
|
71
|
+
'dvb',
|
|
72
|
+
'vmin',
|
|
73
|
+
'svmin',
|
|
74
|
+
'lvmin',
|
|
75
|
+
'dvmin',
|
|
76
|
+
'vmax',
|
|
77
|
+
'svmax',
|
|
78
|
+
'lvmax',
|
|
79
|
+
'dvmax',
|
|
80
|
+
'cqw',
|
|
81
|
+
'cqh',
|
|
82
|
+
'cqi',
|
|
83
|
+
'cqb',
|
|
84
|
+
'cqmin',
|
|
85
|
+
'cqmax',
|
|
86
|
+
'deg',
|
|
87
|
+
'grad',
|
|
88
|
+
'rad',
|
|
89
|
+
'turn',
|
|
90
|
+
's',
|
|
91
|
+
'ms',
|
|
92
|
+
'hz',
|
|
93
|
+
'khz',
|
|
94
|
+
'dpi',
|
|
95
|
+
'dpcm',
|
|
96
|
+
'dppx',
|
|
97
|
+
'x',
|
|
98
|
+
'fr',
|
|
99
|
+
'db',
|
|
100
|
+
'st'
|
|
101
|
+
];
|
|
102
|
+
const UNIT_REGEX = /^([+-.]?\d+(\.?\d+)?)(%|cm|mm|q|in|pt|pc|px|em|rem|ex|rex|cap|rcap|ch|rch|ic|ric|lh|rlh|vw|svw|lvw|dvw|vh|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax|cqw|cqh|cqi|cqb|cqmin|cqmax|deg|grad|rad|turn|s|ms|hz|khz|dpi|dpcm|dppx|x|fr|db|st)?$/;
|
|
103
|
+
const IMAGE_VALUE_REGEX = /(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\(.*\)/;
|
|
104
|
+
const COLOR_VALUE_REGEX = /(?:#|(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla)\\(.*\\)|(?:\$colors)(?![a-zA-Z0-9-]))/;
|
|
105
|
+
const NUMBER_VALUE_REGEX = /(?:[\d.]|(?:max|min|calc|clamp)\(.*\))/;
|
|
106
|
+
const OFFICIAL_URL = new URL('https://rc.css.master.co');
|
|
107
|
+
|
|
108
|
+
exports.ANIMATION_SIGN = ANIMATION_SIGN;
|
|
109
|
+
exports.AT_SIGN = AT_SIGN;
|
|
110
|
+
exports.BASE_UNIT_REGEX = BASE_UNIT_REGEX;
|
|
111
|
+
exports.COLOR_VALUE_REGEX = COLOR_VALUE_REGEX;
|
|
112
|
+
exports.DELIMITER_SIGN = DELIMITER_SIGN;
|
|
113
|
+
exports.IMAGE_VALUE_REGEX = IMAGE_VALUE_REGEX;
|
|
114
|
+
exports.NUMBER_VALUE_REGEX = NUMBER_VALUE_REGEX;
|
|
115
|
+
exports.OFFICIAL_URL = OFFICIAL_URL;
|
|
116
|
+
exports.QUERY_COMPARISON_OPERATORS = QUERY_COMPARISON_OPERATORS;
|
|
117
|
+
exports.QUERY_LOGICAL_OPERATORS = QUERY_LOGICAL_OPERATORS;
|
|
118
|
+
exports.SELECTOR_SIGNS = SELECTOR_SIGNS;
|
|
119
|
+
exports.SEPARATOR_SIGN = SEPARATOR_SIGN;
|
|
120
|
+
exports.SEPARATOR_SIGNS = SEPARATOR_SIGNS;
|
|
121
|
+
exports.TRANSITION_SIGN = TRANSITION_SIGN;
|
|
122
|
+
exports.UNIT_REGEX = UNIT_REGEX;
|
|
123
|
+
exports.VALUE_DELIMITERS = VALUE_DELIMITERS;
|
|
124
|
+
exports.VALUE_UNITS = VALUE_UNITS;
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const VALUE_DELIMITERS: {
|
|
2
|
+
'(': string;
|
|
3
|
+
'\'': string;
|
|
4
|
+
'"': string;
|
|
5
|
+
'{': string;
|
|
6
|
+
};
|
|
7
|
+
export declare const BASE_UNIT_REGEX: RegExp;
|
|
8
|
+
export declare const TRANSITION_SIGN = "~";
|
|
9
|
+
export declare const ANIMATION_SIGN = "@";
|
|
10
|
+
export declare const SELECTOR_SIGNS: string[];
|
|
11
|
+
export declare const QUERY_COMPARISON_OPERATORS: string[];
|
|
12
|
+
export declare const QUERY_LOGICAL_OPERATORS: string[];
|
|
13
|
+
export declare const SEPARATOR_SIGNS: string[];
|
|
14
|
+
export declare const DELIMITER_SIGN = "|";
|
|
15
|
+
export declare const SEPARATOR_SIGN = ",";
|
|
16
|
+
export declare const AT_SIGN = "@";
|
|
17
|
+
export declare const VALUE_UNITS: string[];
|
|
18
|
+
export declare const UNIT_REGEX: RegExp;
|
|
19
|
+
export declare const IMAGE_VALUE_REGEX: RegExp;
|
|
20
|
+
export declare const COLOR_VALUE_REGEX: RegExp;
|
|
21
|
+
export declare const NUMBER_VALUE_REGEX: RegExp;
|
|
22
|
+
export declare const OFFICIAL_URL: URL;
|
package/dist/common.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const VALUE_DELIMITERS = {
|
|
2
|
+
'(': ')',
|
|
3
|
+
'\'': '\'',
|
|
4
|
+
'"': '"',
|
|
5
|
+
'{': '}'
|
|
6
|
+
};
|
|
7
|
+
const BASE_UNIT_REGEX = /^([+-]?(?:\d+(?:\.?\d+)?|\.\d+))x$/m // 1x, 1.1x, -1x, -.1x
|
|
8
|
+
;
|
|
9
|
+
const TRANSITION_SIGN = '~';
|
|
10
|
+
const ANIMATION_SIGN = '@';
|
|
11
|
+
const SELECTOR_SIGNS = [
|
|
12
|
+
':',
|
|
13
|
+
'_',
|
|
14
|
+
'>',
|
|
15
|
+
'+',
|
|
16
|
+
'~'
|
|
17
|
+
];
|
|
18
|
+
const QUERY_COMPARISON_OPERATORS = [
|
|
19
|
+
'>',
|
|
20
|
+
'<',
|
|
21
|
+
'='
|
|
22
|
+
];
|
|
23
|
+
const QUERY_LOGICAL_OPERATORS = [
|
|
24
|
+
'&'
|
|
25
|
+
];
|
|
26
|
+
const SEPARATOR_SIGNS = [
|
|
27
|
+
',',
|
|
28
|
+
'|'
|
|
29
|
+
];
|
|
30
|
+
const DELIMITER_SIGN = '|';
|
|
31
|
+
const SEPARATOR_SIGN = ',';
|
|
32
|
+
const AT_SIGN = '@';
|
|
33
|
+
const VALUE_UNITS = [
|
|
34
|
+
'%',
|
|
35
|
+
'cm',
|
|
36
|
+
'mm',
|
|
37
|
+
'q',
|
|
38
|
+
'in',
|
|
39
|
+
'pt',
|
|
40
|
+
'pc',
|
|
41
|
+
'px',
|
|
42
|
+
'em',
|
|
43
|
+
'rem',
|
|
44
|
+
'ex',
|
|
45
|
+
'rex',
|
|
46
|
+
'cap',
|
|
47
|
+
'rcap',
|
|
48
|
+
'ch',
|
|
49
|
+
'rch',
|
|
50
|
+
'ic',
|
|
51
|
+
'ric',
|
|
52
|
+
'lh',
|
|
53
|
+
'rlh',
|
|
54
|
+
'vw',
|
|
55
|
+
'svw',
|
|
56
|
+
'lvw',
|
|
57
|
+
'dvw',
|
|
58
|
+
'vh',
|
|
59
|
+
'svh',
|
|
60
|
+
'lvh',
|
|
61
|
+
'dvh',
|
|
62
|
+
'vi',
|
|
63
|
+
'svi',
|
|
64
|
+
'lvi',
|
|
65
|
+
'dvi',
|
|
66
|
+
'vb',
|
|
67
|
+
'svb',
|
|
68
|
+
'lvb',
|
|
69
|
+
'dvb',
|
|
70
|
+
'vmin',
|
|
71
|
+
'svmin',
|
|
72
|
+
'lvmin',
|
|
73
|
+
'dvmin',
|
|
74
|
+
'vmax',
|
|
75
|
+
'svmax',
|
|
76
|
+
'lvmax',
|
|
77
|
+
'dvmax',
|
|
78
|
+
'cqw',
|
|
79
|
+
'cqh',
|
|
80
|
+
'cqi',
|
|
81
|
+
'cqb',
|
|
82
|
+
'cqmin',
|
|
83
|
+
'cqmax',
|
|
84
|
+
'deg',
|
|
85
|
+
'grad',
|
|
86
|
+
'rad',
|
|
87
|
+
'turn',
|
|
88
|
+
's',
|
|
89
|
+
'ms',
|
|
90
|
+
'hz',
|
|
91
|
+
'khz',
|
|
92
|
+
'dpi',
|
|
93
|
+
'dpcm',
|
|
94
|
+
'dppx',
|
|
95
|
+
'x',
|
|
96
|
+
'fr',
|
|
97
|
+
'db',
|
|
98
|
+
'st'
|
|
99
|
+
];
|
|
100
|
+
const UNIT_REGEX = /^([+-.]?\d+(\.?\d+)?)(%|cm|mm|q|in|pt|pc|px|em|rem|ex|rex|cap|rcap|ch|rch|ic|ric|lh|rlh|vw|svw|lvw|dvw|vh|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax|cqw|cqh|cqi|cqb|cqmin|cqmax|deg|grad|rad|turn|s|ms|hz|khz|dpi|dpcm|dppx|x|fr|db|st)?$/;
|
|
101
|
+
const IMAGE_VALUE_REGEX = /(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\(.*\)/;
|
|
102
|
+
const COLOR_VALUE_REGEX = /(?:#|(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla)\\(.*\\)|(?:\$colors)(?![a-zA-Z0-9-]))/;
|
|
103
|
+
const NUMBER_VALUE_REGEX = /(?:[\d.]|(?:max|min|calc|clamp)\(.*\))/;
|
|
104
|
+
const OFFICIAL_URL = new URL('https://rc.css.master.co');
|
|
105
|
+
|
|
106
|
+
export { ANIMATION_SIGN, AT_SIGN, BASE_UNIT_REGEX, COLOR_VALUE_REGEX, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var common = require('../common.cjs');
|
|
4
4
|
|
|
5
5
|
const functions = {
|
|
6
6
|
$: {
|
|
7
|
-
colored: true,
|
|
8
7
|
transform (value) {
|
|
9
8
|
let name;
|
|
10
9
|
let fallback;
|
|
@@ -19,7 +18,8 @@ const functions = {
|
|
|
19
18
|
{
|
|
20
19
|
type: 'variable',
|
|
21
20
|
name,
|
|
22
|
-
fallback
|
|
21
|
+
fallback,
|
|
22
|
+
token: value
|
|
23
23
|
}
|
|
24
24
|
];
|
|
25
25
|
}
|
|
@@ -46,13 +46,16 @@ const functions = {
|
|
|
46
46
|
}
|
|
47
47
|
if (current) {
|
|
48
48
|
if (!isVarFunction) {
|
|
49
|
-
const result =
|
|
49
|
+
const result = common.BASE_UNIT_REGEX.exec(current);
|
|
50
50
|
if (result) {
|
|
51
51
|
current = (+result[1] * (this.css.config.baseUnit ?? 1)).toString();
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
if (!bypassParsing && !parentBypassParsing) {
|
|
55
|
-
const valueComponent =
|
|
55
|
+
const valueComponent = {
|
|
56
|
+
...this.parseValue(current),
|
|
57
|
+
token: current
|
|
58
|
+
};
|
|
56
59
|
if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
|
|
57
60
|
hasUnit = true;
|
|
58
61
|
}
|
|
@@ -67,14 +70,16 @@ const functions = {
|
|
|
67
70
|
} else {
|
|
68
71
|
currentValueComponents.push({
|
|
69
72
|
type: 'number',
|
|
70
|
-
value: +current
|
|
73
|
+
value: +current,
|
|
74
|
+
token: current
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
77
|
} else {
|
|
74
78
|
if (isChildHandler) {
|
|
75
79
|
const newValueComponent = {
|
|
76
80
|
type: 'string',
|
|
77
|
-
value: current
|
|
81
|
+
value: current,
|
|
82
|
+
token: current
|
|
78
83
|
};
|
|
79
84
|
unparsedValueComponents.push(newValueComponent);
|
|
80
85
|
currentValueComponents.push(newValueComponent);
|
|
@@ -85,7 +90,8 @@ const functions = {
|
|
|
85
90
|
} else {
|
|
86
91
|
currentValueComponents.push({
|
|
87
92
|
type: 'string',
|
|
88
|
-
value: current
|
|
93
|
+
value: current,
|
|
94
|
+
token: current
|
|
89
95
|
});
|
|
90
96
|
}
|
|
91
97
|
current = '';
|
|
@@ -104,13 +110,15 @@ const functions = {
|
|
|
104
110
|
currentValueComponents.push({
|
|
105
111
|
type: 'separator',
|
|
106
112
|
value: separator,
|
|
107
|
-
text: separator
|
|
113
|
+
text: separator,
|
|
114
|
+
token: separator
|
|
108
115
|
});
|
|
109
116
|
} else {
|
|
110
117
|
currentValueComponents.push({
|
|
111
118
|
type: 'separator',
|
|
112
119
|
value: separator,
|
|
113
|
-
text: prefix + separator + suffix
|
|
120
|
+
text: prefix + separator + suffix,
|
|
121
|
+
token: separator
|
|
114
122
|
});
|
|
115
123
|
}
|
|
116
124
|
}
|
|
@@ -121,20 +129,24 @@ const functions = {
|
|
|
121
129
|
currentValueComponents.push({
|
|
122
130
|
type: 'separator',
|
|
123
131
|
value: '/',
|
|
124
|
-
text: ' / '
|
|
132
|
+
text: ' / ',
|
|
133
|
+
token: '/'
|
|
125
134
|
}, {
|
|
126
135
|
type: 'number',
|
|
127
|
-
value: this.css.config.rootSize
|
|
136
|
+
value: this.css.config.rootSize,
|
|
137
|
+
token: String(this.css.config.rootSize)
|
|
128
138
|
});
|
|
129
139
|
}
|
|
130
140
|
currentValueComponents.push({
|
|
131
141
|
type: 'separator',
|
|
132
142
|
value: '*',
|
|
133
|
-
text: ' * '
|
|
143
|
+
text: ' * ',
|
|
144
|
+
token: '*'
|
|
134
145
|
}, {
|
|
135
146
|
type: 'number',
|
|
136
147
|
value: 1,
|
|
137
|
-
unit: this.definition.unit
|
|
148
|
+
unit: this.definition.unit,
|
|
149
|
+
token: this.definition.unit
|
|
138
150
|
});
|
|
139
151
|
};
|
|
140
152
|
const handleUnitChecking = ()=>{
|
|
@@ -151,7 +163,8 @@ const functions = {
|
|
|
151
163
|
if (symbolResult) {
|
|
152
164
|
currentValueComponents.push({
|
|
153
165
|
type: 'string',
|
|
154
|
-
value: symbolResult[1]
|
|
166
|
+
value: symbolResult[1],
|
|
167
|
+
token: symbolResult[1]
|
|
155
168
|
});
|
|
156
169
|
}
|
|
157
170
|
const functionName = symbolResult ? current.slice(1) : current;
|
|
@@ -160,7 +173,8 @@ const functions = {
|
|
|
160
173
|
name: functionName,
|
|
161
174
|
symbol: char,
|
|
162
175
|
children: [],
|
|
163
|
-
bypassTransform: functionName === 'calc'
|
|
176
|
+
bypassTransform: functionName === 'calc',
|
|
177
|
+
token: current
|
|
164
178
|
};
|
|
165
179
|
currentValueComponents.push(newValueComponent);
|
|
166
180
|
current = '';
|
|
@@ -179,7 +193,7 @@ const functions = {
|
|
|
179
193
|
clear('');
|
|
180
194
|
if (hasUnit) {
|
|
181
195
|
for (const eachUnparsedValueComponent of unparsedValueComponents){
|
|
182
|
-
Object.assign(eachUnparsedValueComponent, this.
|
|
196
|
+
Object.assign(eachUnparsedValueComponent, this.parseValue(eachUnparsedValueComponent.value));
|
|
183
197
|
}
|
|
184
198
|
}
|
|
185
199
|
return hasUnit;
|
|
@@ -297,16 +311,13 @@ const functions = {
|
|
|
297
311
|
unit: ''
|
|
298
312
|
},
|
|
299
313
|
color: {
|
|
300
|
-
unit: ''
|
|
301
|
-
colored: true
|
|
314
|
+
unit: ''
|
|
302
315
|
},
|
|
303
316
|
'color-contrast': {
|
|
304
|
-
unit: ''
|
|
305
|
-
colored: true
|
|
317
|
+
unit: ''
|
|
306
318
|
},
|
|
307
319
|
'color-mix': {
|
|
308
|
-
unit: ''
|
|
309
|
-
colored: true
|
|
320
|
+
unit: ''
|
|
310
321
|
},
|
|
311
322
|
hwb: {
|
|
312
323
|
unit: ''
|
|
@@ -329,24 +340,12 @@ const functions = {
|
|
|
329
340
|
repeat: {
|
|
330
341
|
unit: ''
|
|
331
342
|
},
|
|
332
|
-
'linear-gradient': {
|
|
333
|
-
|
|
334
|
-
},
|
|
335
|
-
'
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
'conic-gradient': {
|
|
339
|
-
colored: true
|
|
340
|
-
},
|
|
341
|
-
'repeating-linear-gradient': {
|
|
342
|
-
colored: true
|
|
343
|
-
},
|
|
344
|
-
'repeating-radial-gradient': {
|
|
345
|
-
colored: true
|
|
346
|
-
},
|
|
347
|
-
'repeating-conic-gradient': {
|
|
348
|
-
colored: true
|
|
349
|
-
}
|
|
343
|
+
'linear-gradient': {},
|
|
344
|
+
'radial-gradient': {},
|
|
345
|
+
'conic-gradient': {},
|
|
346
|
+
'repeating-linear-gradient': {},
|
|
347
|
+
'repeating-radial-gradient': {},
|
|
348
|
+
'repeating-conic-gradient': {}
|
|
350
349
|
};
|
|
351
350
|
|
|
352
351
|
module.exports = functions;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BASE_UNIT_REGEX } from '../
|
|
1
|
+
import { BASE_UNIT_REGEX } from '../common.mjs';
|
|
2
2
|
|
|
3
3
|
const functions = {
|
|
4
4
|
$: {
|
|
5
|
-
colored: true,
|
|
6
5
|
transform (value) {
|
|
7
6
|
let name;
|
|
8
7
|
let fallback;
|
|
@@ -17,7 +16,8 @@ const functions = {
|
|
|
17
16
|
{
|
|
18
17
|
type: 'variable',
|
|
19
18
|
name,
|
|
20
|
-
fallback
|
|
19
|
+
fallback,
|
|
20
|
+
token: value
|
|
21
21
|
}
|
|
22
22
|
];
|
|
23
23
|
}
|
|
@@ -50,7 +50,10 @@ const functions = {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
if (!bypassParsing && !parentBypassParsing) {
|
|
53
|
-
const valueComponent =
|
|
53
|
+
const valueComponent = {
|
|
54
|
+
...this.parseValue(current),
|
|
55
|
+
token: current
|
|
56
|
+
};
|
|
54
57
|
if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
|
|
55
58
|
hasUnit = true;
|
|
56
59
|
}
|
|
@@ -65,14 +68,16 @@ const functions = {
|
|
|
65
68
|
} else {
|
|
66
69
|
currentValueComponents.push({
|
|
67
70
|
type: 'number',
|
|
68
|
-
value: +current
|
|
71
|
+
value: +current,
|
|
72
|
+
token: current
|
|
69
73
|
});
|
|
70
74
|
}
|
|
71
75
|
} else {
|
|
72
76
|
if (isChildHandler) {
|
|
73
77
|
const newValueComponent = {
|
|
74
78
|
type: 'string',
|
|
75
|
-
value: current
|
|
79
|
+
value: current,
|
|
80
|
+
token: current
|
|
76
81
|
};
|
|
77
82
|
unparsedValueComponents.push(newValueComponent);
|
|
78
83
|
currentValueComponents.push(newValueComponent);
|
|
@@ -83,7 +88,8 @@ const functions = {
|
|
|
83
88
|
} else {
|
|
84
89
|
currentValueComponents.push({
|
|
85
90
|
type: 'string',
|
|
86
|
-
value: current
|
|
91
|
+
value: current,
|
|
92
|
+
token: current
|
|
87
93
|
});
|
|
88
94
|
}
|
|
89
95
|
current = '';
|
|
@@ -102,13 +108,15 @@ const functions = {
|
|
|
102
108
|
currentValueComponents.push({
|
|
103
109
|
type: 'separator',
|
|
104
110
|
value: separator,
|
|
105
|
-
text: separator
|
|
111
|
+
text: separator,
|
|
112
|
+
token: separator
|
|
106
113
|
});
|
|
107
114
|
} else {
|
|
108
115
|
currentValueComponents.push({
|
|
109
116
|
type: 'separator',
|
|
110
117
|
value: separator,
|
|
111
|
-
text: prefix + separator + suffix
|
|
118
|
+
text: prefix + separator + suffix,
|
|
119
|
+
token: separator
|
|
112
120
|
});
|
|
113
121
|
}
|
|
114
122
|
}
|
|
@@ -119,20 +127,24 @@ const functions = {
|
|
|
119
127
|
currentValueComponents.push({
|
|
120
128
|
type: 'separator',
|
|
121
129
|
value: '/',
|
|
122
|
-
text: ' / '
|
|
130
|
+
text: ' / ',
|
|
131
|
+
token: '/'
|
|
123
132
|
}, {
|
|
124
133
|
type: 'number',
|
|
125
|
-
value: this.css.config.rootSize
|
|
134
|
+
value: this.css.config.rootSize,
|
|
135
|
+
token: String(this.css.config.rootSize)
|
|
126
136
|
});
|
|
127
137
|
}
|
|
128
138
|
currentValueComponents.push({
|
|
129
139
|
type: 'separator',
|
|
130
140
|
value: '*',
|
|
131
|
-
text: ' * '
|
|
141
|
+
text: ' * ',
|
|
142
|
+
token: '*'
|
|
132
143
|
}, {
|
|
133
144
|
type: 'number',
|
|
134
145
|
value: 1,
|
|
135
|
-
unit: this.definition.unit
|
|
146
|
+
unit: this.definition.unit,
|
|
147
|
+
token: this.definition.unit
|
|
136
148
|
});
|
|
137
149
|
};
|
|
138
150
|
const handleUnitChecking = ()=>{
|
|
@@ -149,7 +161,8 @@ const functions = {
|
|
|
149
161
|
if (symbolResult) {
|
|
150
162
|
currentValueComponents.push({
|
|
151
163
|
type: 'string',
|
|
152
|
-
value: symbolResult[1]
|
|
164
|
+
value: symbolResult[1],
|
|
165
|
+
token: symbolResult[1]
|
|
153
166
|
});
|
|
154
167
|
}
|
|
155
168
|
const functionName = symbolResult ? current.slice(1) : current;
|
|
@@ -158,7 +171,8 @@ const functions = {
|
|
|
158
171
|
name: functionName,
|
|
159
172
|
symbol: char,
|
|
160
173
|
children: [],
|
|
161
|
-
bypassTransform: functionName === 'calc'
|
|
174
|
+
bypassTransform: functionName === 'calc',
|
|
175
|
+
token: current
|
|
162
176
|
};
|
|
163
177
|
currentValueComponents.push(newValueComponent);
|
|
164
178
|
current = '';
|
|
@@ -177,7 +191,7 @@ const functions = {
|
|
|
177
191
|
clear('');
|
|
178
192
|
if (hasUnit) {
|
|
179
193
|
for (const eachUnparsedValueComponent of unparsedValueComponents){
|
|
180
|
-
Object.assign(eachUnparsedValueComponent, this.
|
|
194
|
+
Object.assign(eachUnparsedValueComponent, this.parseValue(eachUnparsedValueComponent.value));
|
|
181
195
|
}
|
|
182
196
|
}
|
|
183
197
|
return hasUnit;
|
|
@@ -295,16 +309,13 @@ const functions = {
|
|
|
295
309
|
unit: ''
|
|
296
310
|
},
|
|
297
311
|
color: {
|
|
298
|
-
unit: ''
|
|
299
|
-
colored: true
|
|
312
|
+
unit: ''
|
|
300
313
|
},
|
|
301
314
|
'color-contrast': {
|
|
302
|
-
unit: ''
|
|
303
|
-
colored: true
|
|
315
|
+
unit: ''
|
|
304
316
|
},
|
|
305
317
|
'color-mix': {
|
|
306
|
-
unit: ''
|
|
307
|
-
colored: true
|
|
318
|
+
unit: ''
|
|
308
319
|
},
|
|
309
320
|
hwb: {
|
|
310
321
|
unit: ''
|
|
@@ -327,24 +338,12 @@ const functions = {
|
|
|
327
338
|
repeat: {
|
|
328
339
|
unit: ''
|
|
329
340
|
},
|
|
330
|
-
'linear-gradient': {
|
|
331
|
-
|
|
332
|
-
},
|
|
333
|
-
'
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
'conic-gradient': {
|
|
337
|
-
colored: true
|
|
338
|
-
},
|
|
339
|
-
'repeating-linear-gradient': {
|
|
340
|
-
colored: true
|
|
341
|
-
},
|
|
342
|
-
'repeating-radial-gradient': {
|
|
343
|
-
colored: true
|
|
344
|
-
},
|
|
345
|
-
'repeating-conic-gradient': {
|
|
346
|
-
colored: true
|
|
347
|
-
}
|
|
341
|
+
'linear-gradient': {},
|
|
342
|
+
'radial-gradient': {},
|
|
343
|
+
'conic-gradient': {},
|
|
344
|
+
'repeating-linear-gradient': {},
|
|
345
|
+
'repeating-radial-gradient': {},
|
|
346
|
+
'repeating-conic-gradient': {}
|
|
348
347
|
};
|
|
349
348
|
|
|
350
349
|
export { functions as default };
|
package/dist/config/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var queries = require('./queries.cjs');
|
|
3
4
|
var selectors = require('./selectors.cjs');
|
|
4
|
-
var
|
|
5
|
+
var utilities = require('./utilities.cjs');
|
|
5
6
|
var animations = require('./animations.cjs');
|
|
6
7
|
var variables = require('./variables.cjs');
|
|
7
8
|
var rules = require('./rules.cjs');
|
|
8
9
|
var functions = require('./functions.cjs');
|
|
9
|
-
var screenSizes = require('../tokens/screen-sizes.cjs');
|
|
10
10
|
|
|
11
11
|
const config = {
|
|
12
|
-
|
|
12
|
+
queries,
|
|
13
13
|
selectors,
|
|
14
|
-
|
|
14
|
+
utilities,
|
|
15
15
|
rules: rules.default,
|
|
16
16
|
functions,
|
|
17
17
|
animations,
|
|
@@ -21,14 +21,14 @@ const config = {
|
|
|
21
21
|
baseUnit: 4,
|
|
22
22
|
override: false,
|
|
23
23
|
important: false,
|
|
24
|
-
|
|
24
|
+
modeDriver: 'class'
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
exports.queries = queries;
|
|
27
28
|
exports.selectors = selectors;
|
|
28
|
-
exports.
|
|
29
|
+
exports.utilities = utilities;
|
|
29
30
|
exports.animations = animations;
|
|
30
31
|
exports.variables = variables;
|
|
31
32
|
exports.rules = rules.default;
|
|
32
33
|
exports.functions = functions;
|
|
33
|
-
exports.mediaQueries = screenSizes;
|
|
34
34
|
exports.config = config;
|