@master/css 2.0.0-rc.4 → 2.0.0-rc.41
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 +4 -43
- package/dist/_virtual/_commonjsHelpers.cjs +5 -0
- package/dist/_virtual/_commonjsHelpers.mjs +3 -0
- package/dist/_virtual/css-escape.cjs +5 -0
- package/dist/_virtual/css-escape.mjs +3 -0
- package/dist/bin/index.cjs +11 -0
- package/dist/bin/index.d.ts +0 -1
- package/dist/bin/index.mjs +9 -0
- package/dist/common.cjs +159 -0
- package/dist/common.d.ts +26 -0
- package/dist/common.mjs +137 -0
- package/dist/config/animations.cjs +113 -0
- package/dist/config/animations.mjs +111 -0
- package/dist/config/at.cjs +14 -0
- package/dist/config/at.d.ts +11 -0
- package/dist/config/at.mjs +12 -0
- package/dist/config/functions.cjs +351 -0
- package/dist/config/functions.mjs +349 -0
- package/dist/config/index.cjs +36 -0
- package/dist/config/index.d.ts +24 -21
- package/dist/config/index.mjs +26 -0
- package/dist/config/modes.cjs +8 -0
- package/dist/config/modes.d.ts +3 -0
- package/dist/config/modes.mjs +6 -0
- package/dist/config/selectors.cjs +28 -0
- package/dist/config/selectors.d.ts +0 -1
- package/dist/config/selectors.mjs +26 -0
- package/dist/config/styles.cjs +2 -0
- package/dist/config/styles.mjs +1 -0
- package/dist/config/syntaxes.cjs +2283 -0
- package/dist/config/syntaxes.d.ts +282 -0
- package/dist/config/syntaxes.mjs +2281 -0
- package/dist/config/utilities.cjs +204 -0
- package/dist/config/{semantics.d.ts → utilities.d.ts} +15 -5
- package/dist/config/utilities.mjs +202 -0
- package/dist/config/variables.cjs +337 -0
- package/dist/config/variables.d.ts +1 -550
- package/dist/config/variables.mjs +335 -0
- package/dist/core.cjs +1040 -0
- package/dist/core.d.ts +39 -35
- package/dist/core.mjs +1035 -0
- package/dist/index.cjs +73 -0
- package/dist/index.d.ts +15 -8
- package/dist/index.mjs +22 -0
- package/dist/layer.cjs +28 -0
- package/dist/layer.d.ts +26 -9
- package/dist/layer.mjs +26 -0
- package/dist/polyfills/css-escape.cjs +8 -0
- package/dist/polyfills/css-escape.mjs +2 -0
- package/dist/polyfills/css-escape2.cjs +68 -0
- package/dist/polyfills/css-escape2.mjs +64 -0
- package/dist/rule.cjs +722 -0
- package/dist/rule.d.ts +62 -24
- package/dist/rule.mjs +720 -0
- package/dist/shared/utils/css-escape.cjs +56 -0
- package/dist/shared/utils/css-escape.mjs +54 -0
- package/dist/types/global.cjs +2 -0
- package/dist/types/global.d.ts +3 -3
- package/dist/types/global.mjs +1 -0
- package/dist/utils/are-rule-at-equal.cjs +22 -0
- package/dist/utils/are-rule-at-equal.d.ts +2 -0
- package/dist/utils/are-rule-at-equal.mjs +20 -0
- 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-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-syntaxes-duplicated.cjs +17 -0
- package/dist/utils/are-syntaxes-duplicated.d.ts +2 -0
- package/dist/utils/are-syntaxes-duplicated.mjs +15 -0
- package/dist/utils/autofill-solid-style.cjs +31 -0
- package/dist/utils/autofill-solid-style.d.ts +3 -0
- package/dist/utils/autofill-solid-style.mjs +29 -0
- package/dist/utils/extend-config.cjs +74 -0
- package/dist/utils/extend-config.d.ts +1 -1
- package/dist/utils/extend-config.mjs +72 -0
- package/dist/utils/flatten-object.cjs +15 -0
- package/dist/utils/flatten-object.mjs +13 -0
- 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 +30 -0
- package/dist/utils/hex-to-rgb.d.ts +1 -1
- package/dist/utils/hex-to-rgb.mjs +28 -0
- 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/utils/reorder-for-readable-classes.cjs +62 -0
- package/dist/{functions → utils}/reorder-for-readable-classes.d.ts +2 -6
- package/dist/utils/reorder-for-readable-classes.mjs +60 -0
- package/package.json +1 -1
- package/dist/bin/index.bundle.js +0 -36
- package/dist/config/media-queries.d.ts +0 -1
- package/dist/config/rules.d.ts +0 -279
- package/dist/constants/base-unit-regex.d.ts +0 -1
- package/dist/constants/config-esm-text.d.ts +0 -1
- package/dist/constants/config-text.d.ts +0 -1
- package/dist/constants/config-ts-text.d.ts +0 -1
- package/dist/constants/start-symbol.d.ts +0 -6
- package/dist/functions/transform-color-with-opacity.d.ts +0 -1
- package/dist/index.bundle.js +0 -35
- package/dist/index.bundle.mjs +0 -35
- package/dist/tokens/screen-sizes.d.ts +0 -14
- package/dist/utils/concat-arrays.d.ts +0 -1
- package/dist/utils/get-type.d.ts +0 -7
- package/dist/utils/is-plain-object.d.ts +0 -8
- package/dist/utils/is-symbol.d.ts +0 -7
- package/dist/utils/rgb-to-hex.d.ts +0 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { BASE_UNIT_REGEX } from '../common.mjs';
|
|
2
|
+
|
|
3
|
+
const functions = {
|
|
4
|
+
$: {
|
|
5
|
+
transform (value) {
|
|
6
|
+
let name;
|
|
7
|
+
let fallback;
|
|
8
|
+
const firstCommaIndex = value.indexOf(',');
|
|
9
|
+
if (firstCommaIndex !== -1) {
|
|
10
|
+
name = value.slice(0, firstCommaIndex);
|
|
11
|
+
fallback = value.slice(firstCommaIndex + 1);
|
|
12
|
+
} else {
|
|
13
|
+
name = value;
|
|
14
|
+
}
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
type: 'variable',
|
|
18
|
+
name,
|
|
19
|
+
fallback,
|
|
20
|
+
token: value
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
calc: {
|
|
26
|
+
transform (value, bypassVariableNames) {
|
|
27
|
+
const valueComponents = [];
|
|
28
|
+
let i = 0;
|
|
29
|
+
const anaylzeDeeply = (currentValueComponents, bypassHandlingSeparator, parentBypassParsing, parentUnitChecking, isVarFunction)=>{
|
|
30
|
+
const isChildHandler = valueComponents !== currentValueComponents;
|
|
31
|
+
const unparsedValueComponents = [];
|
|
32
|
+
let bypassParsing = false;
|
|
33
|
+
let hasUnit = false;
|
|
34
|
+
let currentHasUnit = false;
|
|
35
|
+
let unitChecking = false;
|
|
36
|
+
let childHasUnit = undefined;
|
|
37
|
+
let current = '';
|
|
38
|
+
const clear = (separator, prefix = '', suffix = '')=>{
|
|
39
|
+
if (childHasUnit === false && separator !== ' ' && this.definition.unit) {
|
|
40
|
+
childHasUnit = undefined;
|
|
41
|
+
if (!unitChecking) {
|
|
42
|
+
pushUnitValueComponents();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (current) {
|
|
46
|
+
if (!isVarFunction) {
|
|
47
|
+
const result = BASE_UNIT_REGEX.exec(current);
|
|
48
|
+
if (result) {
|
|
49
|
+
current = (+result[1] * (this.css.config.baseUnit ?? 1)).toString();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!bypassParsing && !parentBypassParsing) {
|
|
53
|
+
const valueComponent = {
|
|
54
|
+
...this.parseValue(current),
|
|
55
|
+
token: current
|
|
56
|
+
};
|
|
57
|
+
if (!hasUnit && isNaN(+current) && valueComponent.type === 'number') {
|
|
58
|
+
hasUnit = true;
|
|
59
|
+
}
|
|
60
|
+
if (unitChecking) {
|
|
61
|
+
if (isNaN(+current)) {
|
|
62
|
+
if (valueComponent.type === 'number') {
|
|
63
|
+
currentValueComponents.push(valueComponent);
|
|
64
|
+
currentHasUnit = true;
|
|
65
|
+
} else {
|
|
66
|
+
currentValueComponents.push(valueComponent);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
currentValueComponents.push({
|
|
70
|
+
type: 'number',
|
|
71
|
+
value: +current,
|
|
72
|
+
token: current
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
if (isChildHandler) {
|
|
77
|
+
const newValueComponent = {
|
|
78
|
+
type: 'string',
|
|
79
|
+
value: current,
|
|
80
|
+
token: current
|
|
81
|
+
};
|
|
82
|
+
unparsedValueComponents.push(newValueComponent);
|
|
83
|
+
currentValueComponents.push(newValueComponent);
|
|
84
|
+
} else {
|
|
85
|
+
currentValueComponents.push(valueComponent);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
currentValueComponents.push({
|
|
90
|
+
type: 'string',
|
|
91
|
+
value: current,
|
|
92
|
+
token: current
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
current = '';
|
|
96
|
+
}
|
|
97
|
+
if (separator) {
|
|
98
|
+
if (separator === '+' || separator === '-') {
|
|
99
|
+
handleUnitChecking();
|
|
100
|
+
}
|
|
101
|
+
if (prefix && value[i - 1] === ' ') {
|
|
102
|
+
prefix = '';
|
|
103
|
+
}
|
|
104
|
+
if (suffix && value[i + 1] === ' ') {
|
|
105
|
+
suffix = '';
|
|
106
|
+
}
|
|
107
|
+
if (bypassHandlingSeparator) {
|
|
108
|
+
currentValueComponents.push({
|
|
109
|
+
type: 'separator',
|
|
110
|
+
value: separator,
|
|
111
|
+
text: separator,
|
|
112
|
+
token: separator
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
currentValueComponents.push({
|
|
116
|
+
type: 'separator',
|
|
117
|
+
value: separator,
|
|
118
|
+
text: prefix + separator + suffix,
|
|
119
|
+
token: separator
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
bypassParsing = false;
|
|
124
|
+
};
|
|
125
|
+
const pushUnitValueComponents = ()=>{
|
|
126
|
+
if (this.definition.unit === 'rem' || this.definition.unit === 'em') {
|
|
127
|
+
currentValueComponents.push({
|
|
128
|
+
type: 'separator',
|
|
129
|
+
value: '/',
|
|
130
|
+
text: ' / ',
|
|
131
|
+
token: '/'
|
|
132
|
+
}, {
|
|
133
|
+
type: 'number',
|
|
134
|
+
value: this.css.config.rootSize,
|
|
135
|
+
token: String(this.css.config.rootSize)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
currentValueComponents.push({
|
|
139
|
+
type: 'separator',
|
|
140
|
+
value: '*',
|
|
141
|
+
text: ' * ',
|
|
142
|
+
token: '*'
|
|
143
|
+
}, {
|
|
144
|
+
type: 'number',
|
|
145
|
+
value: 1,
|
|
146
|
+
unit: this.definition.unit,
|
|
147
|
+
token: this.definition.unit
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const handleUnitChecking = ()=>{
|
|
151
|
+
if (unitChecking && !currentHasUnit && !parentUnitChecking && (!isChildHandler || hasUnit)) {
|
|
152
|
+
pushUnitValueComponents();
|
|
153
|
+
}
|
|
154
|
+
unitChecking = false;
|
|
155
|
+
currentHasUnit = false;
|
|
156
|
+
};
|
|
157
|
+
for(; i < value.length; i++){
|
|
158
|
+
const char = value[i];
|
|
159
|
+
if (char === '(') {
|
|
160
|
+
const symbolResult = /^([+-])/.exec(current);
|
|
161
|
+
if (symbolResult) {
|
|
162
|
+
currentValueComponents.push({
|
|
163
|
+
type: 'string',
|
|
164
|
+
value: symbolResult[1],
|
|
165
|
+
token: symbolResult[1]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const functionName = symbolResult ? current.slice(1) : current;
|
|
169
|
+
const newValueComponent = {
|
|
170
|
+
type: 'function',
|
|
171
|
+
name: functionName,
|
|
172
|
+
symbol: char,
|
|
173
|
+
children: [],
|
|
174
|
+
bypassTransform: functionName === 'calc',
|
|
175
|
+
token: current
|
|
176
|
+
};
|
|
177
|
+
currentValueComponents.push(newValueComponent);
|
|
178
|
+
current = '';
|
|
179
|
+
i++;
|
|
180
|
+
const isVarFunction = functionName === '$' || functionName === 'var';
|
|
181
|
+
childHasUnit = anaylzeDeeply(newValueComponent.children, functionName !== '' && functionName !== 'calc' && (isVarFunction || Object.prototype.hasOwnProperty.call(functions, functionName)), bypassParsing || isVarFunction || unitChecking && currentHasUnit, unitChecking, isVarFunction) || functionName === 'var';
|
|
182
|
+
if (!childHasUnit && functionName === '$') {
|
|
183
|
+
const variableType = this.css.variables[newValueComponent.children[0].value]?.type;
|
|
184
|
+
childHasUnit = !variableType || variableType === 'string';
|
|
185
|
+
}
|
|
186
|
+
if (childHasUnit) {
|
|
187
|
+
hasUnit = true;
|
|
188
|
+
currentHasUnit = true;
|
|
189
|
+
}
|
|
190
|
+
} else if (char === ')') {
|
|
191
|
+
clear('');
|
|
192
|
+
if (hasUnit) {
|
|
193
|
+
for (const eachUnparsedValueComponent of unparsedValueComponents){
|
|
194
|
+
Object.assign(eachUnparsedValueComponent, this.parseValue(eachUnparsedValueComponent.value));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return hasUnit;
|
|
198
|
+
} else if (char === ',') {
|
|
199
|
+
clear(char, '', ' ');
|
|
200
|
+
} else if (char === ' ') {
|
|
201
|
+
clear(char);
|
|
202
|
+
} else {
|
|
203
|
+
const previousChar = value[i - 1];
|
|
204
|
+
switch(char){
|
|
205
|
+
case '+':
|
|
206
|
+
if (!current && previousChar !== ')') {
|
|
207
|
+
current += char;
|
|
208
|
+
} else {
|
|
209
|
+
clear(char, ' ', ' ');
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
case '-':
|
|
213
|
+
if (!current && previousChar !== ')') {
|
|
214
|
+
current += char;
|
|
215
|
+
} else {
|
|
216
|
+
clear(char, ' ', ' ');
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case '*':
|
|
220
|
+
if (this.definition.unit) {
|
|
221
|
+
unitChecking = true;
|
|
222
|
+
}
|
|
223
|
+
clear(char, ' ', ' ');
|
|
224
|
+
break;
|
|
225
|
+
case '/':
|
|
226
|
+
if (this.definition.unit) {
|
|
227
|
+
unitChecking = true;
|
|
228
|
+
}
|
|
229
|
+
clear(char, ' ', ' ');
|
|
230
|
+
bypassParsing = true;
|
|
231
|
+
break;
|
|
232
|
+
default:
|
|
233
|
+
current += char;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
clear('');
|
|
239
|
+
handleUnitChecking();
|
|
240
|
+
};
|
|
241
|
+
anaylzeDeeply(valueComponents, false, false, false, false);
|
|
242
|
+
return 'calc(' + this.resolveValue(valueComponents, functions.calc.unit ?? this.definition.unit, bypassVariableNames, true) + ')';
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
translate: {
|
|
246
|
+
unit: 'rem'
|
|
247
|
+
},
|
|
248
|
+
translateX: {
|
|
249
|
+
unit: 'rem'
|
|
250
|
+
},
|
|
251
|
+
translateY: {
|
|
252
|
+
unit: 'rem'
|
|
253
|
+
},
|
|
254
|
+
translateZ: {
|
|
255
|
+
unit: 'rem'
|
|
256
|
+
},
|
|
257
|
+
translate3d: {
|
|
258
|
+
unit: 'rem'
|
|
259
|
+
},
|
|
260
|
+
skew: {
|
|
261
|
+
unit: 'deg'
|
|
262
|
+
},
|
|
263
|
+
skewX: {
|
|
264
|
+
unit: 'deg'
|
|
265
|
+
},
|
|
266
|
+
skewY: {
|
|
267
|
+
unit: 'deg'
|
|
268
|
+
},
|
|
269
|
+
skewZ: {
|
|
270
|
+
unit: 'deg'
|
|
271
|
+
},
|
|
272
|
+
skew3d: {
|
|
273
|
+
unit: 'deg'
|
|
274
|
+
},
|
|
275
|
+
rotate: {
|
|
276
|
+
unit: 'deg'
|
|
277
|
+
},
|
|
278
|
+
rotateX: {
|
|
279
|
+
unit: 'deg'
|
|
280
|
+
},
|
|
281
|
+
rotateY: {
|
|
282
|
+
unit: 'deg'
|
|
283
|
+
},
|
|
284
|
+
rotateZ: {
|
|
285
|
+
unit: 'deg'
|
|
286
|
+
},
|
|
287
|
+
rotate3d: {
|
|
288
|
+
unit: 'deg'
|
|
289
|
+
},
|
|
290
|
+
blur: {
|
|
291
|
+
unit: 'rem'
|
|
292
|
+
},
|
|
293
|
+
'drop-shadow': {
|
|
294
|
+
unit: 'rem'
|
|
295
|
+
},
|
|
296
|
+
'hue-rotate': {
|
|
297
|
+
unit: 'deg'
|
|
298
|
+
},
|
|
299
|
+
rgb: {
|
|
300
|
+
unit: ''
|
|
301
|
+
},
|
|
302
|
+
rgba: {
|
|
303
|
+
unit: ''
|
|
304
|
+
},
|
|
305
|
+
hsl: {
|
|
306
|
+
unit: ''
|
|
307
|
+
},
|
|
308
|
+
hsla: {
|
|
309
|
+
unit: ''
|
|
310
|
+
},
|
|
311
|
+
color: {
|
|
312
|
+
unit: ''
|
|
313
|
+
},
|
|
314
|
+
'color-contrast': {
|
|
315
|
+
unit: ''
|
|
316
|
+
},
|
|
317
|
+
'color-mix': {
|
|
318
|
+
unit: ''
|
|
319
|
+
},
|
|
320
|
+
hwb: {
|
|
321
|
+
unit: ''
|
|
322
|
+
},
|
|
323
|
+
lab: {
|
|
324
|
+
unit: ''
|
|
325
|
+
},
|
|
326
|
+
lch: {
|
|
327
|
+
unit: ''
|
|
328
|
+
},
|
|
329
|
+
oklab: {
|
|
330
|
+
unit: ''
|
|
331
|
+
},
|
|
332
|
+
oklch: {
|
|
333
|
+
unit: ''
|
|
334
|
+
},
|
|
335
|
+
clamp: {
|
|
336
|
+
unit: ''
|
|
337
|
+
},
|
|
338
|
+
repeat: {
|
|
339
|
+
unit: ''
|
|
340
|
+
},
|
|
341
|
+
'linear-gradient': {},
|
|
342
|
+
'radial-gradient': {},
|
|
343
|
+
'conic-gradient': {},
|
|
344
|
+
'repeating-linear-gradient': {},
|
|
345
|
+
'repeating-radial-gradient': {},
|
|
346
|
+
'repeating-conic-gradient': {}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export { functions as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var at = require('./at.cjs');
|
|
4
|
+
var selectors = require('./selectors.cjs');
|
|
5
|
+
var utilities = require('./utilities.cjs');
|
|
6
|
+
var animations = require('./animations.cjs');
|
|
7
|
+
var variables = require('./variables.cjs');
|
|
8
|
+
var syntaxes = require('./syntaxes.cjs');
|
|
9
|
+
var modes = require('./modes.cjs');
|
|
10
|
+
var functions = require('./functions.cjs');
|
|
11
|
+
|
|
12
|
+
const config = {
|
|
13
|
+
at,
|
|
14
|
+
selectors,
|
|
15
|
+
utilities,
|
|
16
|
+
syntaxes,
|
|
17
|
+
functions,
|
|
18
|
+
animations,
|
|
19
|
+
variables,
|
|
20
|
+
modes,
|
|
21
|
+
scope: '',
|
|
22
|
+
rootSize: 16,
|
|
23
|
+
baseUnit: 4,
|
|
24
|
+
override: false,
|
|
25
|
+
important: false
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.at = at;
|
|
29
|
+
exports.selectors = selectors;
|
|
30
|
+
exports.utilities = utilities;
|
|
31
|
+
exports.animations = animations;
|
|
32
|
+
exports.variables = variables;
|
|
33
|
+
exports.syntaxes = syntaxes;
|
|
34
|
+
exports.modes = modes;
|
|
35
|
+
exports.functions = functions;
|
|
36
|
+
exports.config = config;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import at from './at';
|
|
2
2
|
import selectors from './selectors';
|
|
3
|
-
import
|
|
3
|
+
import utilities from './utilities';
|
|
4
4
|
import animations from './animations';
|
|
5
5
|
import variables from './variables';
|
|
6
|
-
import
|
|
6
|
+
import syntaxes from './syntaxes';
|
|
7
|
+
import modes from './modes';
|
|
7
8
|
import functions from './functions';
|
|
8
9
|
import type { PropertiesHyphen } from 'csstype';
|
|
9
|
-
import type { Rule,
|
|
10
|
+
import type { Rule, SyntaxDefinition, ValueComponent } from '../rule';
|
|
10
11
|
declare const config: Config;
|
|
11
|
-
export { config,
|
|
12
|
-
export type VariableValue = number | string | Array<number | string>;
|
|
12
|
+
export { config, at, selectors, utilities, syntaxes, functions, animations, variables, modes };
|
|
13
|
+
export type VariableValue = number | string | false | Array<number | string>;
|
|
13
14
|
export type VariableDefinition = {
|
|
14
15
|
[key in '' | `@${string}` | string]?: VariableValue | VariableDefinition;
|
|
15
|
-
};
|
|
16
|
+
} | VariableValue;
|
|
16
17
|
export type CSSKeyframes = {
|
|
17
18
|
[key in 'from' | 'to' | string]: PropertiesHyphen;
|
|
18
19
|
};
|
|
@@ -20,30 +21,32 @@ export type AnimationDefinitions = {
|
|
|
20
21
|
[key: string]: CSSKeyframes;
|
|
21
22
|
};
|
|
22
23
|
export type SelectorDefinitions = {
|
|
23
|
-
[key: string]: string | string[]
|
|
24
|
+
[key: string]: string | string[];
|
|
24
25
|
};
|
|
25
|
-
export type
|
|
26
|
-
[key: string]: number | string |
|
|
26
|
+
export type AtDefinitions = {
|
|
27
|
+
[key: string]: number | string | AtDefinitions;
|
|
27
28
|
};
|
|
28
29
|
export type StyleDefinitions = {
|
|
29
30
|
[key: string]: string | StyleDefinitions;
|
|
30
31
|
};
|
|
31
|
-
export type
|
|
32
|
-
[key in keyof typeof
|
|
32
|
+
export type SyntaxDefinitions = {
|
|
33
|
+
[key in keyof typeof syntaxes | string]?: SyntaxDefinition;
|
|
33
34
|
};
|
|
34
35
|
export type VariableDefinitions = {
|
|
35
|
-
[key in keyof typeof
|
|
36
|
+
[key in keyof typeof syntaxes]?: VariableDefinition;
|
|
36
37
|
} & {
|
|
37
|
-
[key: string]: VariableDefinition
|
|
38
|
+
[key: string]: VariableDefinition;
|
|
38
39
|
};
|
|
39
|
-
export type
|
|
40
|
-
[key in keyof typeof
|
|
40
|
+
export type UtilityDefinitions = {
|
|
41
|
+
[key in keyof typeof utilities]?: PropertiesHyphen;
|
|
41
42
|
} & {
|
|
42
43
|
[key: string]: PropertiesHyphen;
|
|
43
44
|
};
|
|
45
|
+
export type ModeDefinitions = {
|
|
46
|
+
[key: string]: 'class' | 'media' | 'host' | false;
|
|
47
|
+
};
|
|
44
48
|
export interface FunctionDefinition {
|
|
45
49
|
unit?: string;
|
|
46
|
-
colored?: boolean;
|
|
47
50
|
transform?(this: Rule, value: string, bypassVariableNames: string[]): string | ValueComponent[];
|
|
48
51
|
}
|
|
49
52
|
export type FunctionDefinitions = {
|
|
@@ -52,11 +55,11 @@ export type FunctionDefinitions = {
|
|
|
52
55
|
export interface Config {
|
|
53
56
|
extends?: (Config | any)[];
|
|
54
57
|
styles?: StyleDefinitions;
|
|
55
|
-
|
|
58
|
+
at?: AtDefinitions;
|
|
56
59
|
selectors?: SelectorDefinitions;
|
|
57
|
-
|
|
60
|
+
utilities?: UtilityDefinitions;
|
|
58
61
|
variables?: VariableDefinitions;
|
|
59
|
-
|
|
62
|
+
syntaxes?: SyntaxDefinitions;
|
|
60
63
|
rootSize?: number;
|
|
61
64
|
baseUnit?: number;
|
|
62
65
|
scope?: string;
|
|
@@ -64,5 +67,5 @@ export interface Config {
|
|
|
64
67
|
override?: boolean;
|
|
65
68
|
functions?: FunctionDefinitions;
|
|
66
69
|
animations?: AnimationDefinitions;
|
|
67
|
-
|
|
70
|
+
modes?: ModeDefinitions;
|
|
68
71
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import at from './at.mjs';
|
|
2
|
+
import selectors from './selectors.mjs';
|
|
3
|
+
import utilities from './utilities.mjs';
|
|
4
|
+
import animations from './animations.mjs';
|
|
5
|
+
import variables from './variables.mjs';
|
|
6
|
+
import syntaxes from './syntaxes.mjs';
|
|
7
|
+
import modes from './modes.mjs';
|
|
8
|
+
import functions from './functions.mjs';
|
|
9
|
+
|
|
10
|
+
const config = {
|
|
11
|
+
at,
|
|
12
|
+
selectors,
|
|
13
|
+
utilities,
|
|
14
|
+
syntaxes,
|
|
15
|
+
functions,
|
|
16
|
+
animations,
|
|
17
|
+
variables,
|
|
18
|
+
modes,
|
|
19
|
+
scope: '',
|
|
20
|
+
rootSize: 16,
|
|
21
|
+
baseUnit: 4,
|
|
22
|
+
override: false,
|
|
23
|
+
important: false
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { animations, at, config, functions, modes, selectors, syntaxes, utilities, variables };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const selectors = {
|
|
4
|
+
'::scrollbar': '::-webkit-scrollbar',
|
|
5
|
+
'::scrollbar-button': '::-webkit-scrollbar-button',
|
|
6
|
+
'::scrollbar-thumb': '::-webkit-scrollbar-thumb',
|
|
7
|
+
'::scrollbar-track': '::-webkit-scrollbar-track',
|
|
8
|
+
'::scrollbar-track-piece': '::-webkit-scrollbar-track-piece',
|
|
9
|
+
'::scrollbar-corner': '::-webkit-scrollbar-corner',
|
|
10
|
+
'::slider-thumb': [
|
|
11
|
+
'::-webkit-slider-thumb',
|
|
12
|
+
'::-moz-range-thumb'
|
|
13
|
+
],
|
|
14
|
+
'::slider-runnable-track': [
|
|
15
|
+
'::-webkit-slider-runnable-track',
|
|
16
|
+
'::-moz-range-track'
|
|
17
|
+
],
|
|
18
|
+
'::resizer': '::-webkit-resizer',
|
|
19
|
+
'::progress': '::-webkit-progress',
|
|
20
|
+
':first': ':first-child',
|
|
21
|
+
':last': ':last-child',
|
|
22
|
+
':even': ':nth-child(2n)',
|
|
23
|
+
':odd': ':nth-child(odd)',
|
|
24
|
+
':nth(': ':nth-child(',
|
|
25
|
+
':only': ':only-child'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports = selectors;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const selectors = {
|
|
2
|
+
'::scrollbar': '::-webkit-scrollbar',
|
|
3
|
+
'::scrollbar-button': '::-webkit-scrollbar-button',
|
|
4
|
+
'::scrollbar-thumb': '::-webkit-scrollbar-thumb',
|
|
5
|
+
'::scrollbar-track': '::-webkit-scrollbar-track',
|
|
6
|
+
'::scrollbar-track-piece': '::-webkit-scrollbar-track-piece',
|
|
7
|
+
'::scrollbar-corner': '::-webkit-scrollbar-corner',
|
|
8
|
+
'::slider-thumb': [
|
|
9
|
+
'::-webkit-slider-thumb',
|
|
10
|
+
'::-moz-range-thumb'
|
|
11
|
+
],
|
|
12
|
+
'::slider-runnable-track': [
|
|
13
|
+
'::-webkit-slider-runnable-track',
|
|
14
|
+
'::-moz-range-track'
|
|
15
|
+
],
|
|
16
|
+
'::resizer': '::-webkit-resizer',
|
|
17
|
+
'::progress': '::-webkit-progress',
|
|
18
|
+
':first': ':first-child',
|
|
19
|
+
':last': ':last-child',
|
|
20
|
+
':even': ':nth-child(2n)',
|
|
21
|
+
':odd': ':nth-child(odd)',
|
|
22
|
+
':nth(': ':nth-child(',
|
|
23
|
+
':only': ':only-child'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { selectors as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|