@master/css 2.0.0-rc.69 → 2.0.0-rc.70
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/README.md +6 -8
- package/dist/index.d.ts +2 -40
- package/dist/index.mjs +1 -42
- package/package.json +1 -1
- package/src/base.css +1 -0
- package/src/index.css +1 -0
- package/src/theme.css +1 -0
- package/src/utilities.css +1 -0
- package/src/variants.css +1 -0
- package/dist/_virtual/_commonjsHelpers.cjs +0 -10
- package/dist/_virtual/_commonjsHelpers.mjs +0 -7
- package/dist/_virtual/css-escape.cjs +0 -5
- package/dist/_virtual/css-escape.mjs +0 -3
- package/dist/animation-rule.cjs +0 -24
- package/dist/animation-rule.d.ts +0 -11
- package/dist/animation-rule.mjs +0 -22
- package/dist/bin/index.cjs +0 -11
- package/dist/bin/index.d.ts +0 -1
- package/dist/bin/index.mjs +0 -9
- package/dist/common.cjs +0 -208
- package/dist/common.d.ts +0 -40
- package/dist/common.mjs +0 -180
- package/dist/config/animations.cjs +0 -113
- package/dist/config/animations.d.ts +0 -110
- package/dist/config/animations.mjs +0 -111
- package/dist/config/at.cjs +0 -19
- package/dist/config/at.d.ts +0 -16
- package/dist/config/at.mjs +0 -17
- package/dist/config/functions.cjs +0 -141
- package/dist/config/functions.d.ts +0 -138
- package/dist/config/functions.mjs +0 -139
- package/dist/config/index.cjs +0 -40
- package/dist/config/index.d.ts +0 -12
- package/dist/config/index.mjs +0 -29
- package/dist/config/modes.cjs +0 -312
- package/dist/config/modes.d.ts +0 -309
- package/dist/config/modes.mjs +0 -310
- package/dist/config/rules.cjs +0 -2277
- package/dist/config/rules.d.ts +0 -1485
- package/dist/config/rules.mjs +0 -2275
- package/dist/config/screens.cjs +0 -17
- package/dist/config/screens.d.ts +0 -14
- package/dist/config/screens.mjs +0 -15
- package/dist/config/selectors.cjs +0 -25
- package/dist/config/selectors.d.ts +0 -22
- package/dist/config/selectors.mjs +0 -23
- package/dist/config/utilities.cjs +0 -446
- package/dist/config/utilities.d.ts +0 -443
- package/dist/config/utilities.mjs +0 -444
- package/dist/config/variables.cjs +0 -99
- package/dist/config/variables.d.ts +0 -423
- package/dist/config/variables.mjs +0 -97
- package/dist/core.cjs +0 -674
- package/dist/core.d.ts +0 -128
- package/dist/core.mjs +0 -672
- package/dist/create.cjs +0 -10
- package/dist/create.d.ts +0 -3
- package/dist/create.mjs +0 -8
- package/dist/declarers/core.group.cjs +0 -99
- package/dist/declarers/core.group.d.ts +0 -2
- package/dist/declarers/core.group.mjs +0 -97
- package/dist/declarers/core.variable.cjs +0 -9
- package/dist/declarers/core.variable.d.ts +0 -4
- package/dist/declarers/core.variable.mjs +0 -7
- package/dist/declarers/index.cjs +0 -13
- package/dist/declarers/index.d.ts +0 -10
- package/dist/declarers/index.mjs +0 -11
- package/dist/declarers/pair.cjs +0 -12
- package/dist/declarers/pair.d.ts +0 -4
- package/dist/declarers/pair.mjs +0 -10
- package/dist/factories/with-syntax-layer.cjs +0 -83
- package/dist/factories/with-syntax-layer.d.ts +0 -26
- package/dist/factories/with-syntax-layer.mjs +0 -81
- package/dist/function-transformers/core.calc.cjs +0 -225
- package/dist/function-transformers/core.calc.d.ts +0 -2
- package/dist/function-transformers/core.calc.mjs +0 -223
- package/dist/function-transformers/core.variable.cjs +0 -23
- package/dist/function-transformers/core.variable.d.ts +0 -7
- package/dist/function-transformers/core.variable.mjs +0 -21
- package/dist/function-transformers/index.cjs +0 -11
- package/dist/function-transformers/index.d.ts +0 -8
- package/dist/function-transformers/index.mjs +0 -9
- package/dist/index.cjs +0 -118
- package/dist/layer.cjs +0 -52
- package/dist/layer.d.ts +0 -16
- package/dist/layer.mjs +0 -50
- package/dist/non-layer.cjs +0 -55
- package/dist/non-layer.d.ts +0 -12
- package/dist/non-layer.mjs +0 -53
- package/dist/polyfills/css-escape.cjs +0 -9
- package/dist/polyfills/css-escape.d.ts +0 -0
- package/dist/polyfills/css-escape.mjs +0 -7
- package/dist/polyfills/css-escape2.cjs +0 -76
- package/dist/polyfills/css-escape2.mjs +0 -74
- package/dist/register-global.cjs +0 -7
- package/dist/register-global.d.ts +0 -5
- package/dist/register-global.mjs +0 -5
- package/dist/rule.cjs +0 -16
- package/dist/rule.d.ts +0 -7
- package/dist/rule.mjs +0 -14
- package/dist/shared/utils/css-escape.cjs +0 -56
- package/dist/shared/utils/css-escape.mjs +0 -54
- package/dist/shared/utils/find-native-css-rule-index.cjs +0 -12
- package/dist/shared/utils/find-native-css-rule-index.mjs +0 -10
- package/dist/syntax-layer.cjs +0 -8
- package/dist/syntax-layer.d.ts +0 -18
- package/dist/syntax-layer.mjs +0 -6
- package/dist/syntax-rule-type.cjs +0 -27
- package/dist/syntax-rule-type.d.ts +0 -28
- package/dist/syntax-rule-type.mjs +0 -25
- package/dist/syntax-rule.cjs +0 -506
- package/dist/syntax-rule.d.ts +0 -44
- package/dist/syntax-rule.mjs +0 -504
- package/dist/transformers/auto-fill-solid.cjs +0 -31
- package/dist/transformers/auto-fill-solid.d.ts +0 -2
- package/dist/transformers/auto-fill-solid.mjs +0 -29
- package/dist/transformers/index.cjs +0 -9
- package/dist/transformers/index.d.ts +0 -6
- package/dist/transformers/index.mjs +0 -7
- package/dist/types/common.cjs +0 -2
- package/dist/types/common.d.ts +0 -1
- package/dist/types/common.mjs +0 -1
- package/dist/types/config.cjs +0 -2
- package/dist/types/config.d.ts +0 -79
- package/dist/types/config.mjs +0 -1
- package/dist/types/syntax.cjs +0 -2
- package/dist/types/syntax.d.ts +0 -89
- package/dist/types/syntax.mjs +0 -1
- package/dist/utils/compare-rule-priority.cjs +0 -143
- package/dist/utils/compare-rule-priority.d.ts +0 -7
- package/dist/utils/compare-rule-priority.mjs +0 -138
- package/dist/utils/equal-at-rules.cjs +0 -22
- package/dist/utils/equal-at-rules.d.ts +0 -2
- package/dist/utils/equal-at-rules.mjs +0 -20
- package/dist/utils/equal-declarations.cjs +0 -10
- package/dist/utils/equal-declarations.d.ts +0 -2
- package/dist/utils/equal-declarations.mjs +0 -8
- package/dist/utils/equal-selectors.cjs +0 -69
- package/dist/utils/equal-selectors.d.ts +0 -2
- package/dist/utils/equal-selectors.mjs +0 -67
- package/dist/utils/equal-variants.cjs +0 -10
- package/dist/utils/equal-variants.d.ts +0 -2
- package/dist/utils/equal-variants.mjs +0 -8
- package/dist/utils/extend-config.cjs +0 -97
- package/dist/utils/extend-config.d.ts +0 -11
- package/dist/utils/extend-config.mjs +0 -95
- package/dist/utils/flatten-meta-object.cjs +0 -38
- package/dist/utils/flatten-meta-object.d.ts +0 -13
- package/dist/utils/flatten-meta-object.mjs +0 -36
- package/dist/utils/flatten-object.cjs +0 -19
- package/dist/utils/flatten-object.d.ts +0 -1
- package/dist/utils/flatten-object.mjs +0 -17
- package/dist/utils/generate-at.cjs +0 -30
- package/dist/utils/generate-at.d.ts +0 -2
- package/dist/utils/generate-at.mjs +0 -28
- package/dist/utils/generate-css.cjs +0 -13
- package/dist/utils/generate-css.d.ts +0 -1
- package/dist/utils/generate-css.mjs +0 -11
- package/dist/utils/generate-selector.cjs +0 -50
- package/dist/utils/generate-selector.d.ts +0 -2
- package/dist/utils/generate-selector.mjs +0 -48
- package/dist/utils/get-single-at-number-rule-node.cjs +0 -9
- package/dist/utils/get-single-at-number-rule-node.d.ts +0 -2
- package/dist/utils/get-single-at-number-rule-node.mjs +0 -7
- package/dist/utils/hex-to-rgb.cjs +0 -30
- package/dist/utils/hex-to-rgb.d.ts +0 -1
- package/dist/utils/hex-to-rgb.mjs +0 -28
- package/dist/utils/is-core-rule.cjs +0 -9
- package/dist/utils/is-core-rule.d.ts +0 -1
- package/dist/utils/is-core-rule.mjs +0 -7
- package/dist/utils/minify-extended-config.cjs +0 -64
- package/dist/utils/minify-extended-config.d.ts +0 -9
- package/dist/utils/minify-extended-config.mjs +0 -62
- package/dist/utils/nest-meta-object.cjs +0 -25
- package/dist/utils/nest-meta-object.d.ts +0 -7
- package/dist/utils/nest-meta-object.mjs +0 -23
- package/dist/utils/parse-at.cjs +0 -156
- package/dist/utils/parse-at.d.ts +0 -39
- package/dist/utils/parse-at.mjs +0 -154
- package/dist/utils/parse-pair.cjs +0 -48
- package/dist/utils/parse-pair.d.ts +0 -8
- package/dist/utils/parse-pair.mjs +0 -46
- package/dist/utils/parse-selector.cjs +0 -114
- package/dist/utils/parse-selector.d.ts +0 -19
- package/dist/utils/parse-selector.mjs +0 -112
- package/dist/utils/parse-value.cjs +0 -39
- package/dist/utils/parse-value.d.ts +0 -2
- package/dist/utils/parse-value.mjs +0 -37
- package/dist/utils/replace-char-outside-quotes.cjs +0 -21
- package/dist/utils/replace-char-outside-quotes.d.ts +0 -1
- package/dist/utils/replace-char-outside-quotes.mjs +0 -19
- package/dist/utils/sort-readable-classes.cjs +0 -86
- package/dist/utils/sort-readable-classes.d.ts +0 -7
- package/dist/utils/sort-readable-classes.mjs +0 -84
- package/dist/utils/split-char-outside-quotes.cjs +0 -29
- package/dist/utils/split-char-outside-quotes.d.ts +0 -1
- package/dist/utils/split-char-outside-quotes.mjs +0 -27
- package/dist/variable-rule.cjs +0 -92
- package/dist/variable-rule.d.ts +0 -33
- package/dist/variable-rule.mjs +0 -87
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var functions = require('../config/functions.cjs');
|
|
4
|
-
var common = require('../common.cjs');
|
|
5
|
-
|
|
6
|
-
function coreCalc(value, bypassVariableNames) {
|
|
7
|
-
const valueComponents = [];
|
|
8
|
-
let i = 0;
|
|
9
|
-
const anaylzeDeeply = (currentValueComponents, bypassHandlingSeparator, parentBypassParsing, parentUnitChecking, isVarFunction)=>{
|
|
10
|
-
const isChildHandler = valueComponents !== currentValueComponents;
|
|
11
|
-
const unparsedValueComponents = [];
|
|
12
|
-
let bypassParsing = false;
|
|
13
|
-
let hasUnit = false;
|
|
14
|
-
let currentHasUnit = false;
|
|
15
|
-
let unitChecking = false;
|
|
16
|
-
let childHasUnit = undefined;
|
|
17
|
-
let current = '';
|
|
18
|
-
const clear = (separator, prefix = '', suffix = '')=>{
|
|
19
|
-
if (childHasUnit === false && separator !== ' ' && this.definition.unit) {
|
|
20
|
-
childHasUnit = undefined;
|
|
21
|
-
if (!unitChecking) {
|
|
22
|
-
pushUnitValueComponents();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (current) {
|
|
26
|
-
if (!isVarFunction) {
|
|
27
|
-
const result = common.BASE_UNIT_REGEX.exec(current);
|
|
28
|
-
if (result) {
|
|
29
|
-
current = (+result[1] * (this.css.config.baseUnit ?? 1)).toString();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (!bypassParsing && !parentBypassParsing) {
|
|
33
|
-
const valueComponent = {
|
|
34
|
-
...this.parseValue(current),
|
|
35
|
-
token: current
|
|
36
|
-
};
|
|
37
|
-
if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
|
|
38
|
-
hasUnit = true;
|
|
39
|
-
}
|
|
40
|
-
if (unitChecking) {
|
|
41
|
-
if (isNaN(+current)) {
|
|
42
|
-
if (valueComponent.type === 'number') {
|
|
43
|
-
currentValueComponents.push(valueComponent);
|
|
44
|
-
currentHasUnit = true;
|
|
45
|
-
} else {
|
|
46
|
-
currentValueComponents.push(valueComponent);
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
currentValueComponents.push({
|
|
50
|
-
type: 'number',
|
|
51
|
-
value: +current,
|
|
52
|
-
token: current
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
if (isChildHandler) {
|
|
57
|
-
const newValueComponent = {
|
|
58
|
-
type: 'string',
|
|
59
|
-
value: current,
|
|
60
|
-
token: current
|
|
61
|
-
};
|
|
62
|
-
unparsedValueComponents.push(newValueComponent);
|
|
63
|
-
currentValueComponents.push(newValueComponent);
|
|
64
|
-
} else {
|
|
65
|
-
currentValueComponents.push(valueComponent);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
currentValueComponents.push({
|
|
70
|
-
type: 'string',
|
|
71
|
-
value: current,
|
|
72
|
-
token: current
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
current = '';
|
|
76
|
-
}
|
|
77
|
-
if (separator) {
|
|
78
|
-
if (separator === '+' || separator === '-') {
|
|
79
|
-
handleUnitChecking();
|
|
80
|
-
}
|
|
81
|
-
if (prefix && value[i - 1] === ' ') {
|
|
82
|
-
prefix = '';
|
|
83
|
-
}
|
|
84
|
-
if (suffix && value[i + 1] === ' ') {
|
|
85
|
-
suffix = '';
|
|
86
|
-
}
|
|
87
|
-
if (bypassHandlingSeparator) {
|
|
88
|
-
currentValueComponents.push({
|
|
89
|
-
type: 'separator',
|
|
90
|
-
value: separator,
|
|
91
|
-
text: separator,
|
|
92
|
-
token: separator
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
currentValueComponents.push({
|
|
96
|
-
type: 'separator',
|
|
97
|
-
value: separator,
|
|
98
|
-
text: prefix + separator + suffix,
|
|
99
|
-
token: separator
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
bypassParsing = false;
|
|
104
|
-
};
|
|
105
|
-
const pushUnitValueComponents = ()=>{
|
|
106
|
-
if (this.definition.unit === 'rem' || this.definition.unit === 'em') {
|
|
107
|
-
currentValueComponents.push({
|
|
108
|
-
type: 'separator',
|
|
109
|
-
value: '/',
|
|
110
|
-
text: ' / ',
|
|
111
|
-
token: '/'
|
|
112
|
-
}, {
|
|
113
|
-
type: 'number',
|
|
114
|
-
value: this.css.config.rootSize,
|
|
115
|
-
token: String(this.css.config.rootSize)
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
currentValueComponents.push({
|
|
119
|
-
type: 'separator',
|
|
120
|
-
value: '*',
|
|
121
|
-
text: ' * ',
|
|
122
|
-
token: '*'
|
|
123
|
-
}, {
|
|
124
|
-
type: 'number',
|
|
125
|
-
value: 1,
|
|
126
|
-
unit: this.definition.unit,
|
|
127
|
-
token: this.definition.unit
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
const handleUnitChecking = ()=>{
|
|
131
|
-
if (unitChecking && !currentHasUnit && !parentUnitChecking && (!isChildHandler || hasUnit)) {
|
|
132
|
-
pushUnitValueComponents();
|
|
133
|
-
}
|
|
134
|
-
unitChecking = false;
|
|
135
|
-
currentHasUnit = false;
|
|
136
|
-
};
|
|
137
|
-
for(; i < value.length; i++){
|
|
138
|
-
const char = value[i];
|
|
139
|
-
if (char === '(') {
|
|
140
|
-
const symbolResult = /^([+-])/.exec(current);
|
|
141
|
-
if (symbolResult) {
|
|
142
|
-
currentValueComponents.push({
|
|
143
|
-
type: 'string',
|
|
144
|
-
value: symbolResult[1],
|
|
145
|
-
token: symbolResult[1]
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
const functionName = symbolResult ? current.slice(1) : current;
|
|
149
|
-
const newValueComponent = {
|
|
150
|
-
type: 'function',
|
|
151
|
-
name: functionName,
|
|
152
|
-
symbol: char,
|
|
153
|
-
children: [],
|
|
154
|
-
bypassTransform: functionName === 'calc',
|
|
155
|
-
token: current
|
|
156
|
-
};
|
|
157
|
-
currentValueComponents.push(newValueComponent);
|
|
158
|
-
current = '';
|
|
159
|
-
i++;
|
|
160
|
-
const isVarFunction = functionName === '$' || functionName === 'var';
|
|
161
|
-
childHasUnit = anaylzeDeeply(newValueComponent.children, functionName !== '' && functionName !== 'calc' && (isVarFunction || Object.prototype.hasOwnProperty.call(functions, functionName)), bypassParsing || isVarFunction || unitChecking && currentHasUnit, unitChecking, isVarFunction) || functionName === 'var';
|
|
162
|
-
if (!childHasUnit && functionName === '$') {
|
|
163
|
-
const variableType = this.css.variables.get(newValueComponent.children[0].value)?.type;
|
|
164
|
-
childHasUnit = !variableType || variableType === 'string';
|
|
165
|
-
}
|
|
166
|
-
if (childHasUnit) {
|
|
167
|
-
hasUnit = true;
|
|
168
|
-
currentHasUnit = true;
|
|
169
|
-
}
|
|
170
|
-
} else if (char === ')') {
|
|
171
|
-
clear('');
|
|
172
|
-
if (hasUnit) {
|
|
173
|
-
for (const eachUnparsedValueComponent of unparsedValueComponents){
|
|
174
|
-
Object.assign(eachUnparsedValueComponent, this.parseValue(eachUnparsedValueComponent.value));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return hasUnit;
|
|
178
|
-
} else if (char === ',') {
|
|
179
|
-
clear(char, '', ' ');
|
|
180
|
-
} else if (char === ' ') {
|
|
181
|
-
clear(char);
|
|
182
|
-
} else {
|
|
183
|
-
const previousChar = value[i - 1];
|
|
184
|
-
switch(char){
|
|
185
|
-
case '+':
|
|
186
|
-
if (!current && previousChar !== ')') {
|
|
187
|
-
current += char;
|
|
188
|
-
} else {
|
|
189
|
-
clear(char, ' ', ' ');
|
|
190
|
-
}
|
|
191
|
-
break;
|
|
192
|
-
case '-':
|
|
193
|
-
if (!current && previousChar !== ')') {
|
|
194
|
-
current += char;
|
|
195
|
-
} else {
|
|
196
|
-
clear(char, ' ', ' ');
|
|
197
|
-
}
|
|
198
|
-
break;
|
|
199
|
-
case '*':
|
|
200
|
-
if (this.definition.unit) {
|
|
201
|
-
unitChecking = true;
|
|
202
|
-
}
|
|
203
|
-
clear(char, ' ', ' ');
|
|
204
|
-
break;
|
|
205
|
-
case '/':
|
|
206
|
-
if (this.definition.unit) {
|
|
207
|
-
unitChecking = true;
|
|
208
|
-
}
|
|
209
|
-
clear(char, ' ', ' ');
|
|
210
|
-
bypassParsing = true;
|
|
211
|
-
break;
|
|
212
|
-
default:
|
|
213
|
-
current += char;
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
clear('');
|
|
219
|
-
handleUnitChecking();
|
|
220
|
-
};
|
|
221
|
-
anaylzeDeeply(valueComponents, false, false, false, false);
|
|
222
|
-
return 'calc(' + this.resolveValue(valueComponents, this.definition.unit, bypassVariableNames, true) + ')';
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
module.exports = coreCalc;
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import functions from '../config/functions.mjs';
|
|
2
|
-
import { BASE_UNIT_REGEX } from '../common.mjs';
|
|
3
|
-
|
|
4
|
-
function coreCalc(value, bypassVariableNames) {
|
|
5
|
-
const valueComponents = [];
|
|
6
|
-
let i = 0;
|
|
7
|
-
const anaylzeDeeply = (currentValueComponents, bypassHandlingSeparator, parentBypassParsing, parentUnitChecking, isVarFunction)=>{
|
|
8
|
-
const isChildHandler = valueComponents !== currentValueComponents;
|
|
9
|
-
const unparsedValueComponents = [];
|
|
10
|
-
let bypassParsing = false;
|
|
11
|
-
let hasUnit = false;
|
|
12
|
-
let currentHasUnit = false;
|
|
13
|
-
let unitChecking = false;
|
|
14
|
-
let childHasUnit = undefined;
|
|
15
|
-
let current = '';
|
|
16
|
-
const clear = (separator, prefix = '', suffix = '')=>{
|
|
17
|
-
if (childHasUnit === false && separator !== ' ' && this.definition.unit) {
|
|
18
|
-
childHasUnit = undefined;
|
|
19
|
-
if (!unitChecking) {
|
|
20
|
-
pushUnitValueComponents();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (current) {
|
|
24
|
-
if (!isVarFunction) {
|
|
25
|
-
const result = BASE_UNIT_REGEX.exec(current);
|
|
26
|
-
if (result) {
|
|
27
|
-
current = (+result[1] * (this.css.config.baseUnit ?? 1)).toString();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (!bypassParsing && !parentBypassParsing) {
|
|
31
|
-
const valueComponent = {
|
|
32
|
-
...this.parseValue(current),
|
|
33
|
-
token: current
|
|
34
|
-
};
|
|
35
|
-
if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
|
|
36
|
-
hasUnit = true;
|
|
37
|
-
}
|
|
38
|
-
if (unitChecking) {
|
|
39
|
-
if (isNaN(+current)) {
|
|
40
|
-
if (valueComponent.type === 'number') {
|
|
41
|
-
currentValueComponents.push(valueComponent);
|
|
42
|
-
currentHasUnit = true;
|
|
43
|
-
} else {
|
|
44
|
-
currentValueComponents.push(valueComponent);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
currentValueComponents.push({
|
|
48
|
-
type: 'number',
|
|
49
|
-
value: +current,
|
|
50
|
-
token: current
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
if (isChildHandler) {
|
|
55
|
-
const newValueComponent = {
|
|
56
|
-
type: 'string',
|
|
57
|
-
value: current,
|
|
58
|
-
token: current
|
|
59
|
-
};
|
|
60
|
-
unparsedValueComponents.push(newValueComponent);
|
|
61
|
-
currentValueComponents.push(newValueComponent);
|
|
62
|
-
} else {
|
|
63
|
-
currentValueComponents.push(valueComponent);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
currentValueComponents.push({
|
|
68
|
-
type: 'string',
|
|
69
|
-
value: current,
|
|
70
|
-
token: current
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
current = '';
|
|
74
|
-
}
|
|
75
|
-
if (separator) {
|
|
76
|
-
if (separator === '+' || separator === '-') {
|
|
77
|
-
handleUnitChecking();
|
|
78
|
-
}
|
|
79
|
-
if (prefix && value[i - 1] === ' ') {
|
|
80
|
-
prefix = '';
|
|
81
|
-
}
|
|
82
|
-
if (suffix && value[i + 1] === ' ') {
|
|
83
|
-
suffix = '';
|
|
84
|
-
}
|
|
85
|
-
if (bypassHandlingSeparator) {
|
|
86
|
-
currentValueComponents.push({
|
|
87
|
-
type: 'separator',
|
|
88
|
-
value: separator,
|
|
89
|
-
text: separator,
|
|
90
|
-
token: separator
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
currentValueComponents.push({
|
|
94
|
-
type: 'separator',
|
|
95
|
-
value: separator,
|
|
96
|
-
text: prefix + separator + suffix,
|
|
97
|
-
token: separator
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
bypassParsing = false;
|
|
102
|
-
};
|
|
103
|
-
const pushUnitValueComponents = ()=>{
|
|
104
|
-
if (this.definition.unit === 'rem' || this.definition.unit === 'em') {
|
|
105
|
-
currentValueComponents.push({
|
|
106
|
-
type: 'separator',
|
|
107
|
-
value: '/',
|
|
108
|
-
text: ' / ',
|
|
109
|
-
token: '/'
|
|
110
|
-
}, {
|
|
111
|
-
type: 'number',
|
|
112
|
-
value: this.css.config.rootSize,
|
|
113
|
-
token: String(this.css.config.rootSize)
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
currentValueComponents.push({
|
|
117
|
-
type: 'separator',
|
|
118
|
-
value: '*',
|
|
119
|
-
text: ' * ',
|
|
120
|
-
token: '*'
|
|
121
|
-
}, {
|
|
122
|
-
type: 'number',
|
|
123
|
-
value: 1,
|
|
124
|
-
unit: this.definition.unit,
|
|
125
|
-
token: this.definition.unit
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
const handleUnitChecking = ()=>{
|
|
129
|
-
if (unitChecking && !currentHasUnit && !parentUnitChecking && (!isChildHandler || hasUnit)) {
|
|
130
|
-
pushUnitValueComponents();
|
|
131
|
-
}
|
|
132
|
-
unitChecking = false;
|
|
133
|
-
currentHasUnit = false;
|
|
134
|
-
};
|
|
135
|
-
for(; i < value.length; i++){
|
|
136
|
-
const char = value[i];
|
|
137
|
-
if (char === '(') {
|
|
138
|
-
const symbolResult = /^([+-])/.exec(current);
|
|
139
|
-
if (symbolResult) {
|
|
140
|
-
currentValueComponents.push({
|
|
141
|
-
type: 'string',
|
|
142
|
-
value: symbolResult[1],
|
|
143
|
-
token: symbolResult[1]
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const functionName = symbolResult ? current.slice(1) : current;
|
|
147
|
-
const newValueComponent = {
|
|
148
|
-
type: 'function',
|
|
149
|
-
name: functionName,
|
|
150
|
-
symbol: char,
|
|
151
|
-
children: [],
|
|
152
|
-
bypassTransform: functionName === 'calc',
|
|
153
|
-
token: current
|
|
154
|
-
};
|
|
155
|
-
currentValueComponents.push(newValueComponent);
|
|
156
|
-
current = '';
|
|
157
|
-
i++;
|
|
158
|
-
const isVarFunction = functionName === '$' || functionName === 'var';
|
|
159
|
-
childHasUnit = anaylzeDeeply(newValueComponent.children, functionName !== '' && functionName !== 'calc' && (isVarFunction || Object.prototype.hasOwnProperty.call(functions, functionName)), bypassParsing || isVarFunction || unitChecking && currentHasUnit, unitChecking, isVarFunction) || functionName === 'var';
|
|
160
|
-
if (!childHasUnit && functionName === '$') {
|
|
161
|
-
const variableType = this.css.variables.get(newValueComponent.children[0].value)?.type;
|
|
162
|
-
childHasUnit = !variableType || variableType === 'string';
|
|
163
|
-
}
|
|
164
|
-
if (childHasUnit) {
|
|
165
|
-
hasUnit = true;
|
|
166
|
-
currentHasUnit = true;
|
|
167
|
-
}
|
|
168
|
-
} else if (char === ')') {
|
|
169
|
-
clear('');
|
|
170
|
-
if (hasUnit) {
|
|
171
|
-
for (const eachUnparsedValueComponent of unparsedValueComponents){
|
|
172
|
-
Object.assign(eachUnparsedValueComponent, this.parseValue(eachUnparsedValueComponent.value));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return hasUnit;
|
|
176
|
-
} else if (char === ',') {
|
|
177
|
-
clear(char, '', ' ');
|
|
178
|
-
} else if (char === ' ') {
|
|
179
|
-
clear(char);
|
|
180
|
-
} else {
|
|
181
|
-
const previousChar = value[i - 1];
|
|
182
|
-
switch(char){
|
|
183
|
-
case '+':
|
|
184
|
-
if (!current && previousChar !== ')') {
|
|
185
|
-
current += char;
|
|
186
|
-
} else {
|
|
187
|
-
clear(char, ' ', ' ');
|
|
188
|
-
}
|
|
189
|
-
break;
|
|
190
|
-
case '-':
|
|
191
|
-
if (!current && previousChar !== ')') {
|
|
192
|
-
current += char;
|
|
193
|
-
} else {
|
|
194
|
-
clear(char, ' ', ' ');
|
|
195
|
-
}
|
|
196
|
-
break;
|
|
197
|
-
case '*':
|
|
198
|
-
if (this.definition.unit) {
|
|
199
|
-
unitChecking = true;
|
|
200
|
-
}
|
|
201
|
-
clear(char, ' ', ' ');
|
|
202
|
-
break;
|
|
203
|
-
case '/':
|
|
204
|
-
if (this.definition.unit) {
|
|
205
|
-
unitChecking = true;
|
|
206
|
-
}
|
|
207
|
-
clear(char, ' ', ' ');
|
|
208
|
-
bypassParsing = true;
|
|
209
|
-
break;
|
|
210
|
-
default:
|
|
211
|
-
current += char;
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
clear('');
|
|
217
|
-
handleUnitChecking();
|
|
218
|
-
};
|
|
219
|
-
anaylzeDeeply(valueComponents, false, false, false, false);
|
|
220
|
-
return 'calc(' + this.resolveValue(valueComponents, this.definition.unit, bypassVariableNames, true) + ')';
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export { coreCalc as default };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function coreVariable(value) {
|
|
4
|
-
let name;
|
|
5
|
-
let fallback;
|
|
6
|
-
const firstCommaIndex = value.indexOf(',');
|
|
7
|
-
if (firstCommaIndex !== -1) {
|
|
8
|
-
name = value.slice(0, firstCommaIndex);
|
|
9
|
-
fallback = value.slice(firstCommaIndex + 1);
|
|
10
|
-
} else {
|
|
11
|
-
name = value;
|
|
12
|
-
}
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
type: 'variable',
|
|
16
|
-
name,
|
|
17
|
-
fallback,
|
|
18
|
-
token: value
|
|
19
|
-
}
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = coreVariable;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function coreVariable(value) {
|
|
2
|
-
let name;
|
|
3
|
-
let fallback;
|
|
4
|
-
const firstCommaIndex = value.indexOf(',');
|
|
5
|
-
if (firstCommaIndex !== -1) {
|
|
6
|
-
name = value.slice(0, firstCommaIndex);
|
|
7
|
-
fallback = value.slice(firstCommaIndex + 1);
|
|
8
|
-
} else {
|
|
9
|
-
name = value;
|
|
10
|
-
}
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
type: 'variable',
|
|
14
|
-
name,
|
|
15
|
-
fallback,
|
|
16
|
-
token: value
|
|
17
|
-
}
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { coreVariable as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core_calc = require('./core.calc.cjs');
|
|
4
|
-
var core_variable = require('./core.variable.cjs');
|
|
5
|
-
|
|
6
|
-
const functionTransformers = {
|
|
7
|
-
'core.calc': core_calc,
|
|
8
|
-
'core.variable': core_variable
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
module.exports = functionTransformers;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import coreCalc from './core.calc';
|
|
2
|
-
import coreVariable from './core.variable';
|
|
3
|
-
declare const functionTransformers: {
|
|
4
|
-
'core.calc': typeof coreCalc;
|
|
5
|
-
'core.variable': typeof coreVariable;
|
|
6
|
-
};
|
|
7
|
-
export default functionTransformers;
|
|
8
|
-
export type FunctionTransformerNames = keyof typeof functionTransformers;
|
package/dist/index.cjs
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var index = require('./config/index.cjs');
|
|
6
|
-
var common = require('./common.cjs');
|
|
7
|
-
var core = require('./core.cjs');
|
|
8
|
-
var syntaxRule = require('./syntax-rule.cjs');
|
|
9
|
-
var rule = require('./rule.cjs');
|
|
10
|
-
var layer = require('./layer.cjs');
|
|
11
|
-
var syntaxLayer = require('./syntax-layer.cjs');
|
|
12
|
-
var nonLayer = require('./non-layer.cjs');
|
|
13
|
-
var syntaxRuleType = require('./syntax-rule-type.cjs');
|
|
14
|
-
var variableRule = require('./variable-rule.cjs');
|
|
15
|
-
var animationRule = require('./animation-rule.cjs');
|
|
16
|
-
var create = require('./create.cjs');
|
|
17
|
-
var withSyntaxLayer = require('./factories/with-syntax-layer.cjs');
|
|
18
|
-
var extendConfig = require('./utils/extend-config.cjs');
|
|
19
|
-
var sortReadableClasses = require('./utils/sort-readable-classes.cjs');
|
|
20
|
-
var equalAtRules = require('./utils/equal-at-rules.cjs');
|
|
21
|
-
var equalSelectors = require('./utils/equal-selectors.cjs');
|
|
22
|
-
var equalVariants = require('./utils/equal-variants.cjs');
|
|
23
|
-
var equalDeclarations = require('./utils/equal-declarations.cjs');
|
|
24
|
-
var generateCss = require('./utils/generate-css.cjs');
|
|
25
|
-
var isCoreRule = require('./utils/is-core-rule.cjs');
|
|
26
|
-
var parsePair = require('./utils/parse-pair.cjs');
|
|
27
|
-
var parseValue = require('./utils/parse-value.cjs');
|
|
28
|
-
var parseAt = require('./utils/parse-at.cjs');
|
|
29
|
-
var generateAt = require('./utils/generate-at.cjs');
|
|
30
|
-
var parseSelector = require('./utils/parse-selector.cjs');
|
|
31
|
-
var generateSelector = require('./utils/generate-selector.cjs');
|
|
32
|
-
var getSingleAtNumberRuleNode = require('./utils/get-single-at-number-rule-node.cjs');
|
|
33
|
-
var compareRulePriority = require('./utils/compare-rule-priority.cjs');
|
|
34
|
-
var flattenObject = require('./utils/flatten-object.cjs');
|
|
35
|
-
var flattenMetaObject = require('./utils/flatten-meta-object.cjs');
|
|
36
|
-
var nestMetaObject = require('./utils/nest-meta-object.cjs');
|
|
37
|
-
var minifyExtendedConfig = require('./utils/minify-extended-config.cjs');
|
|
38
|
-
var at = require('./config/at.cjs');
|
|
39
|
-
var selectors = require('./config/selectors.cjs');
|
|
40
|
-
var utilities = require('./config/utilities.cjs');
|
|
41
|
-
var rules = require('./config/rules.cjs');
|
|
42
|
-
var functions = require('./config/functions.cjs');
|
|
43
|
-
var animations = require('./config/animations.cjs');
|
|
44
|
-
var variables = require('./config/variables.cjs');
|
|
45
|
-
var modes = require('./config/modes.cjs');
|
|
46
|
-
var screens = require('./config/screens.cjs');
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
exports.config = index.config;
|
|
51
|
-
exports.ANIMATION_SIGN = common.ANIMATION_SIGN;
|
|
52
|
-
exports.AT_COMPARABLE_FEATURES = common.AT_COMPARABLE_FEATURES;
|
|
53
|
-
exports.AT_COMPARISON_OPERATORS = common.AT_COMPARISON_OPERATORS;
|
|
54
|
-
exports.AT_IDENTIFIERS = common.AT_IDENTIFIERS;
|
|
55
|
-
exports.AT_LOGICAL_OPERATORS = common.AT_LOGICAL_OPERATORS;
|
|
56
|
-
exports.AT_SIGN = common.AT_SIGN;
|
|
57
|
-
exports.BASE_UNIT_REGEX = common.BASE_UNIT_REGEX;
|
|
58
|
-
exports.BORDER_STYLE_VALUES = common.BORDER_STYLE_VALUES;
|
|
59
|
-
exports.CLASS_ATTRIBUTES = common.CLASS_ATTRIBUTES;
|
|
60
|
-
exports.CLASS_DECLARATIONS = common.CLASS_DECLARATIONS;
|
|
61
|
-
exports.CLASS_FUNCTIONS = common.CLASS_FUNCTIONS;
|
|
62
|
-
exports.COLOR_VALUE_REGEX = common.COLOR_VALUE_REGEX;
|
|
63
|
-
exports.COMPARISION_OPERATORS = common.COMPARISION_OPERATORS;
|
|
64
|
-
exports.DELIMITER_SIGN = common.DELIMITER_SIGN;
|
|
65
|
-
exports.IMAGE_VALUE_REGEX = common.IMAGE_VALUE_REGEX;
|
|
66
|
-
exports.NUMBER_VALUE_REGEX = common.NUMBER_VALUE_REGEX;
|
|
67
|
-
exports.QUERY_COMPARISON_OPERATORS = common.QUERY_COMPARISON_OPERATORS;
|
|
68
|
-
exports.QUERY_LOGICAL_OPERATORS = common.QUERY_LOGICAL_OPERATORS;
|
|
69
|
-
exports.SELECTOR_COMBINATORS = common.SELECTOR_COMBINATORS;
|
|
70
|
-
exports.SELECTOR_SIGNS = common.SELECTOR_SIGNS;
|
|
71
|
-
exports.SEPARATOR_SIGN = common.SEPARATOR_SIGN;
|
|
72
|
-
exports.SEPARATOR_SIGNS = common.SEPARATOR_SIGNS;
|
|
73
|
-
exports.TRANSITION_SIGN = common.TRANSITION_SIGN;
|
|
74
|
-
exports.UNIT_REGEX = common.UNIT_REGEX;
|
|
75
|
-
exports.VALUE_DELIMITERS = common.VALUE_DELIMITERS;
|
|
76
|
-
exports.VALUE_UNITS = common.VALUE_UNITS;
|
|
77
|
-
exports.__UNSORTED__ = common.__UNSORTED__;
|
|
78
|
-
exports.MasterCSS = core;
|
|
79
|
-
exports.default = core;
|
|
80
|
-
exports.SyntaxRule = syntaxRule.SyntaxRule;
|
|
81
|
-
exports.Rule = rule.Rule;
|
|
82
|
-
exports.Layer = layer;
|
|
83
|
-
exports.SyntaxLayer = syntaxLayer;
|
|
84
|
-
exports.NonLayer = nonLayer;
|
|
85
|
-
exports.SyntaxRuleType = syntaxRuleType;
|
|
86
|
-
exports.VariableRule = variableRule.default;
|
|
87
|
-
exports.AnimationRule = animationRule;
|
|
88
|
-
exports.createCSS = create;
|
|
89
|
-
exports.withSyntaxLayer = withSyntaxLayer;
|
|
90
|
-
exports.extendConfig = extendConfig;
|
|
91
|
-
exports.sortReadableClasses = sortReadableClasses;
|
|
92
|
-
exports.equalAtRules = equalAtRules;
|
|
93
|
-
exports.equalSelectors = equalSelectors;
|
|
94
|
-
exports.equalVariants = equalVariants;
|
|
95
|
-
exports.equalDeclarations = equalDeclarations;
|
|
96
|
-
exports.generateCSS = generateCss;
|
|
97
|
-
exports.isCoreRule = isCoreRule;
|
|
98
|
-
exports.parsePair = parsePair;
|
|
99
|
-
exports.parseValue = parseValue;
|
|
100
|
-
exports.parseAt = parseAt;
|
|
101
|
-
exports.generateAt = generateAt;
|
|
102
|
-
exports.parseSelector = parseSelector;
|
|
103
|
-
exports.generateSelector = generateSelector;
|
|
104
|
-
exports.getSingleAtNumberRuleNode = getSingleAtNumberRuleNode;
|
|
105
|
-
exports.compareRulePriority = compareRulePriority.default;
|
|
106
|
-
exports.flattenObject = flattenObject;
|
|
107
|
-
exports.flattenMetaObject = flattenMetaObject;
|
|
108
|
-
exports.nestMetaObject = nestMetaObject;
|
|
109
|
-
exports.minifyExtendedConfig = minifyExtendedConfig;
|
|
110
|
-
exports.at = at;
|
|
111
|
-
exports.selectors = selectors;
|
|
112
|
-
exports.utilities = utilities;
|
|
113
|
-
exports.rules = rules;
|
|
114
|
-
exports.functions = functions;
|
|
115
|
-
exports.animations = animations;
|
|
116
|
-
exports.variables = variables;
|
|
117
|
-
exports.modes = modes;
|
|
118
|
-
exports.screens = screens;
|