stylelint-browser-compat 1.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +91 -0
- package/lib/at-rules/at_rules_name_set.js +16 -0
- package/lib/at-rules/collect_features.js +145 -0
- package/lib/at-rules/counter-style/collect_features.js +41 -0
- package/lib/at-rules/counter-style/descriptor_name_set.js +16 -0
- package/lib/at-rules/document/collect_features.js +46 -0
- package/lib/at-rules/document/regexp/collect_features.js +30 -0
- package/lib/at-rules/font-face/__font_type/collect_features.js +79 -0
- package/lib/at-rules/font-face/collect_features.js +67 -0
- package/lib/at-rules/font-face/descriptor_name_set.js +16 -0
- package/lib/at-rules/font-feature-values/at_rules_name_set.js +16 -0
- package/lib/at-rules/font-feature-values/collect_features.js +30 -0
- package/lib/at-rules/keyframes/collect_features.js +29 -0
- package/lib/at-rules/media/collect_features.js +118 -0
- package/lib/at-rules/media/media_feature_name_map.js +8 -0
- package/lib/at-rules/page/collect_features.js +82 -0
- package/lib/at-rules/page/descriptor_name_set.js +16 -0
- package/lib/at-rules/page/size/collect_features.js +55 -0
- package/lib/at-rules/property/collect_features.js +60 -0
- package/lib/at-rules/property/descriptor_name_set.js +16 -0
- package/lib/at-rules/scroll-timeline/collect_features.js +60 -0
- package/lib/at-rules/scroll-timeline/descriptor_name_set.js +16 -0
- package/lib/collect_features.js +69 -0
- package/lib/index.js +5 -0
- package/lib/is_supported.js +75 -0
- package/lib/options.js +20 -0
- package/lib/parse_browserslist_version.js +132 -0
- package/lib/properties/-moz-orient/collect_features.js +61 -0
- package/lib/properties/-moz-user-input/collect_features.js +71 -0
- package/lib/properties/animation-direction/collect_features.js +53 -0
- package/lib/properties/animation-timing-function/collect_features.js +51 -0
- package/lib/properties/appearance/collect_features.js +76 -0
- package/lib/properties/background/background-clip/collect_features.js +59 -0
- package/lib/properties/background/background-origin/collect_features.js +59 -0
- package/lib/properties/background/background-size/collect_features.js +106 -0
- package/lib/properties/background/collect_features.js +104 -0
- package/lib/properties/background/multiple_backgrounds/collect_features.js +39 -0
- package/lib/properties/background-attachment/collect_features.js +70 -0
- package/lib/properties/background-clip/collect_features.js +55 -0
- package/lib/properties/background-image/collect_features.js +133 -0
- package/lib/properties/background-image/svg_images/collect_features.js +58 -0
- package/lib/properties/background-origin/collect_features.js +42 -0
- package/lib/properties/background-position/collect_features.js +117 -0
- package/lib/properties/background-position-x/collect_features.js +36 -0
- package/lib/properties/background-position-y/collect_features.js +36 -0
- package/lib/properties/background-repeat/collect_features.js +102 -0
- package/lib/properties/background-repeat/round_space/collect_features.js +54 -0
- package/lib/properties/background-size/collect_features.js +38 -0
- package/lib/properties/block-size/collect_features.js +77 -0
- package/lib/properties/border-bottom-left-radius/border-bottom-right-radius/collect_features.js +57 -0
- package/lib/properties/border-bottom-left-radius/collect_features.js +57 -0
- package/lib/properties/border-bottom-right-radius/collect_features.js +57 -0
- package/lib/properties/border-radius/collect_features.js +61 -0
- package/lib/properties/border-top-left-radius/collect_features.js +57 -0
- package/lib/properties/border-top-right-radius/collect_features.js +57 -0
- package/lib/properties/box-shadow/collect_features.js +92 -0
- package/lib/properties/box-sizing/collect_features.js +39 -0
- package/lib/properties/caption-side/collect_features.js +38 -0
- package/lib/properties/clear/collect_features.js +38 -0
- package/lib/properties/clip-path/collect_features.js +65 -0
- package/lib/properties/collect_features.js +452 -0
- package/lib/properties/color-scheme/collect_features.js +52 -0
- package/lib/properties/property_name_set.js +16 -0
- package/lib/properties/transition/collect_features.js +33 -0
- package/lib/properties/transition-property/collect_features.js +38 -0
- package/lib/rule.js +125 -0
- package/lib/selectors/__attributes/collect_features.js +44 -0
- package/lib/selectors/__classes/collect_features.js +23 -0
- package/lib/selectors/__combinators/collect_features.js +91 -0
- package/lib/selectors/__ids/collect_features.js +23 -0
- package/lib/selectors/__pseudos/collect_features.js +228 -0
- package/lib/selectors/__pseudos/pseudo_selector_name_set.js +18 -0
- package/lib/selectors/__tags/collect_features.js +48 -0
- package/lib/selectors/__universal/collect_features.js +37 -0
- package/lib/selectors/active/non_a_elements/collect_features.js +38 -0
- package/lib/selectors/after/animation_and_transition_support/collect_features.js +43 -0
- package/lib/selectors/backdrop/dialog/collect_features.js +38 -0
- package/lib/selectors/before/animation_and_transition_support/collect_features.js +43 -0
- package/lib/selectors/collect_features.js +120 -0
- package/lib/selectors/cue/selector_argument/collect_features.js +26 -0
- package/lib/selectors/hostfunction/collect_features.js +26 -0
- package/lib/selectors/hover/collect_features.js +61 -0
- package/lib/selectors/invalid/collect_features.js +39 -0
- package/lib/selectors/marker/animation_and_transition_support/collect_features.js +43 -0
- package/lib/selectors/not/selector_list/collect_features.js +31 -0
- package/lib/selectors/nth-child/of_syntax/collect_features.js +32 -0
- package/lib/selectors/nth-last-child/of_syntax/collect_features.js +32 -0
- package/lib/selectors/valid/collect_features.js +39 -0
- package/lib/types/__function/collect_features.js +187 -0
- package/lib/types/attr/collect_features.js +69 -0
- package/lib/types/attr/type_unit_name_map.js +8 -0
- package/lib/types/calc/collect_features.js +70 -0
- package/lib/types/collect_features.js +139 -0
- package/lib/types/color/__alpha_parameter/collect_features.js +37 -0
- package/lib/types/color/__float_values/collect_features.js +44 -0
- package/lib/types/color/__space_separated_parameters/collect_features.js +37 -0
- package/lib/types/color/rgb_hexadecimal_notation/collect_features.js +42 -0
- package/lib/types/easing-function/steps/jump/collect_features.js +37 -0
- package/lib/types/function_name_map.js +8 -0
- package/lib/types/image/gradient/__linear-gradient/collect_features.js +77 -0
- package/lib/types/image/gradient/__linear-gradient/doubleposition/collect_features.js +43 -0
- package/lib/types/image/gradient/__linear-gradient/interpolation_hints/collect_features.js +42 -0
- package/lib/types/image/gradient/__linear-gradient/to/collect_features.js +39 -0
- package/lib/types/image/gradient/__linear-gradient/unitless_0_angle/collect_features.js +40 -0
- package/lib/types/image/gradient/__radial-gradient/at/collect_features.js +44 -0
- package/lib/types/image/gradient/__radial-gradient/collect_features.js +68 -0
- package/lib/types/image/gradient/__radial-gradient/doubleposition/collect_features.js +47 -0
- package/lib/types/image/gradient/__radial-gradient/interpolation_hints/collect_features.js +42 -0
- package/lib/types/image/gradient/conic-gradient/collect_features.js +48 -0
- package/lib/types/image/gradient/conic-gradient/doubleposition/collect_features.js +43 -0
- package/lib/types/number/scientific_notation/collect_features.js +31 -0
- package/lib/types/unit_name_map.js +8 -0
- package/lib/types/value_name_map.js +8 -0
- package/lib/types.js +5 -0
- package/package.json +75 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
|
|
12
|
+
async function collectFeatures({
|
|
13
|
+
functionName,
|
|
14
|
+
node,
|
|
15
|
+
parent
|
|
16
|
+
}) {
|
|
17
|
+
const promises = [];
|
|
18
|
+
|
|
19
|
+
switch (functionName) {
|
|
20
|
+
case 'attr':
|
|
21
|
+
{
|
|
22
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../attr/collect_features"))).then(({
|
|
23
|
+
collectFeatures
|
|
24
|
+
}) => {
|
|
25
|
+
return collectFeatures({
|
|
26
|
+
node,
|
|
27
|
+
parent
|
|
28
|
+
});
|
|
29
|
+
}));
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
case 'calc':
|
|
34
|
+
{
|
|
35
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../calc/collect_features"))).then(({
|
|
36
|
+
collectFeatures
|
|
37
|
+
}) => {
|
|
38
|
+
return collectFeatures({
|
|
39
|
+
node,
|
|
40
|
+
parent
|
|
41
|
+
});
|
|
42
|
+
}));
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
case 'hsl':
|
|
47
|
+
{
|
|
48
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__alpha_parameter/collect_features"))).then(({
|
|
49
|
+
collectFeatures
|
|
50
|
+
}) => {
|
|
51
|
+
return collectFeatures({
|
|
52
|
+
node,
|
|
53
|
+
parent
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
56
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__space_separated_parameters/collect_features"))).then(({
|
|
57
|
+
collectFeatures
|
|
58
|
+
}) => {
|
|
59
|
+
return collectFeatures({
|
|
60
|
+
node,
|
|
61
|
+
parent
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
case 'hsla':
|
|
68
|
+
{
|
|
69
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__space_separated_parameters/collect_features"))).then(({
|
|
70
|
+
collectFeatures
|
|
71
|
+
}) => {
|
|
72
|
+
return collectFeatures({
|
|
73
|
+
node,
|
|
74
|
+
parent
|
|
75
|
+
});
|
|
76
|
+
}));
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
case 'rgb':
|
|
81
|
+
{
|
|
82
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__alpha_parameter/collect_features"))).then(({
|
|
83
|
+
collectFeatures
|
|
84
|
+
}) => {
|
|
85
|
+
return collectFeatures({
|
|
86
|
+
node,
|
|
87
|
+
parent
|
|
88
|
+
});
|
|
89
|
+
}));
|
|
90
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__space_separated_parameters/collect_features"))).then(({
|
|
91
|
+
collectFeatures
|
|
92
|
+
}) => {
|
|
93
|
+
return collectFeatures({
|
|
94
|
+
node,
|
|
95
|
+
parent
|
|
96
|
+
});
|
|
97
|
+
}));
|
|
98
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__float_values/collect_features"))).then(({
|
|
99
|
+
collectFeatures
|
|
100
|
+
}) => {
|
|
101
|
+
return collectFeatures({
|
|
102
|
+
node,
|
|
103
|
+
parent
|
|
104
|
+
});
|
|
105
|
+
}));
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
case 'rgba':
|
|
110
|
+
{
|
|
111
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__space_separated_parameters/collect_features"))).then(({
|
|
112
|
+
collectFeatures
|
|
113
|
+
}) => {
|
|
114
|
+
return collectFeatures({
|
|
115
|
+
node,
|
|
116
|
+
parent
|
|
117
|
+
});
|
|
118
|
+
}));
|
|
119
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../color/__float_values/collect_features"))).then(({
|
|
120
|
+
collectFeatures
|
|
121
|
+
}) => {
|
|
122
|
+
return collectFeatures({
|
|
123
|
+
node,
|
|
124
|
+
parent
|
|
125
|
+
});
|
|
126
|
+
}));
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case 'steps':
|
|
131
|
+
{
|
|
132
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../easing-function/steps/jump/collect_features"))).then(({
|
|
133
|
+
collectFeatures
|
|
134
|
+
}) => {
|
|
135
|
+
return collectFeatures({
|
|
136
|
+
node,
|
|
137
|
+
parent
|
|
138
|
+
});
|
|
139
|
+
}));
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
case 'conic-gradient':
|
|
144
|
+
{
|
|
145
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../image/gradient/conic-gradient/collect_features"))).then(({
|
|
146
|
+
collectFeatures
|
|
147
|
+
}) => {
|
|
148
|
+
return collectFeatures({
|
|
149
|
+
node,
|
|
150
|
+
parent
|
|
151
|
+
});
|
|
152
|
+
}));
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
case 'linear-gradient':
|
|
157
|
+
case 'repeating-linear-gradient':
|
|
158
|
+
{
|
|
159
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../image/gradient/__linear-gradient/collect_features"))).then(({
|
|
160
|
+
collectFeatures
|
|
161
|
+
}) => {
|
|
162
|
+
return collectFeatures({
|
|
163
|
+
node,
|
|
164
|
+
parent
|
|
165
|
+
});
|
|
166
|
+
}));
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
case 'radial-gradient':
|
|
171
|
+
case 'repeating-radial-gradient':
|
|
172
|
+
{
|
|
173
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../image/gradient/__radial-gradient/collect_features"))).then(({
|
|
174
|
+
collectFeatures
|
|
175
|
+
}) => {
|
|
176
|
+
return collectFeatures({
|
|
177
|
+
node,
|
|
178
|
+
parent
|
|
179
|
+
});
|
|
180
|
+
}));
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const features = (await Promise.all(promises)).flat();
|
|
186
|
+
return features;
|
|
187
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
|
|
8
|
+
var _type_unit_name_map = require("./type_unit_name_map");
|
|
9
|
+
|
|
10
|
+
async function collectFeatures({
|
|
11
|
+
node,
|
|
12
|
+
parent
|
|
13
|
+
}) {
|
|
14
|
+
var _parent$raws$between;
|
|
15
|
+
|
|
16
|
+
const funcName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
17
|
+
|
|
18
|
+
if (funcName !== 'attr') {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const features = [];
|
|
23
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
24
|
+
const [, firstDiv, second, secondDiv, third] = node.nodes;
|
|
25
|
+
|
|
26
|
+
if (second != null) {
|
|
27
|
+
if ((firstDiv === null || firstDiv === void 0 ? void 0 : firstDiv.type) === 'div' && firstDiv.value === ',') {
|
|
28
|
+
const index = offset + second.sourceIndex;
|
|
29
|
+
const endIndex = offset + second.sourceEndIndex;
|
|
30
|
+
features.push({
|
|
31
|
+
endIndex,
|
|
32
|
+
id: `types.attr.fallback`,
|
|
33
|
+
index,
|
|
34
|
+
name: `Fallback value for attr()`,
|
|
35
|
+
node: parent
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ((firstDiv === null || firstDiv === void 0 ? void 0 : firstDiv.type) === 'space') {
|
|
40
|
+
const featureId = _type_unit_name_map.typeUnitNameMap.get(second.value);
|
|
41
|
+
|
|
42
|
+
if (featureId != null) {
|
|
43
|
+
const index = offset + second.sourceIndex;
|
|
44
|
+
const endIndex = offset + second.sourceEndIndex;
|
|
45
|
+
features.push({
|
|
46
|
+
endIndex,
|
|
47
|
+
id: featureId,
|
|
48
|
+
index,
|
|
49
|
+
name: `"${second.value}" unit keyword for attr()`,
|
|
50
|
+
node: parent
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (third != null && (secondDiv === null || secondDiv === void 0 ? void 0 : secondDiv.type) === 'div' && secondDiv.value === ',') {
|
|
57
|
+
const index = offset + third.sourceIndex;
|
|
58
|
+
const endIndex = offset + third.sourceEndIndex;
|
|
59
|
+
features.push({
|
|
60
|
+
endIndex,
|
|
61
|
+
id: `types.attr.fallback`,
|
|
62
|
+
index,
|
|
63
|
+
name: `Fallback value for attr()`,
|
|
64
|
+
node: parent
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return features;
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.typeUnitNameMap = void 0;
|
|
7
|
+
const typeUnitNameMap = new Map([['string', 'types.attr.type-or-unit'], ['color', 'types.attr.type-or-unit.color'], ['url', 'types.attr.type-or-unit.url'], ['integer', 'types.attr.type-or-unit.integer'], ['number', 'types.attr.type-or-unit.number'], ['length', 'types.attr.type-or-unit.length'], ['cap', 'types.attr.type-or-unit.length'], ['ch', 'types.attr.type-or-unit.length'], ['em', 'types.attr.type-or-unit.length'], ['ex', 'types.attr.type-or-unit.length'], ['ic', 'types.attr.type-or-unit.length'], ['lh', 'types.attr.type-or-unit.length'], ['rlh', 'types.attr.type-or-unit.length'], ['rem', 'types.attr.type-or-unit.length'], ['vb', 'types.attr.type-or-unit.length'], ['vi', 'types.attr.type-or-unit.length'], ['vw', 'types.attr.type-or-unit.length'], ['vh', 'types.attr.type-or-unit.length'], ['vmin', 'types.attr.type-or-unit.length'], ['vmax', 'types.attr.type-or-unit.length'], ['mm', 'types.attr.type-or-unit.length'], ['Q', 'types.attr.type-or-unit.length'], ['cm', 'types.attr.type-or-unit.length'], ['in', 'types.attr.type-or-unit.length'], ['pt', 'types.attr.type-or-unit.length'], ['pc', 'types.attr.type-or-unit.length'], ['px', 'types.attr.type-or-unit.length'], ['angle', 'types.attr.type-or-unit.angle'], ['deg', 'types.attr.type-or-unit.angle'], ['grad', 'types.attr.type-or-unit.angle'], ['rad', 'types.attr.type-or-unit.angle'], ['turn', 'types.attr.type-or-unit.angle'], ['time', 'types.attr.type-or-unit.time'], ['s', 'types.attr.type-or-unit.time'], ['ms', 'types.attr.type-or-unit.time'], ['frequency', 'types.attr.type-or-unit.frequency'], ['Hz', 'types.attr.type-or-unit.frequency'], ['kHz', 'types.attr.type-or-unit.frequency'], ['hz', 'types.attr.type-or-unit.frequency'], ['khz', 'types.attr.type-or-unit.frequency'], ['%', 'types.attr.type-or-unit.percentage']]);
|
|
8
|
+
exports.typeUnitNameMap = typeUnitNameMap;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
|
|
8
|
+
var _postcssValueParser = require("postcss-value-parser");
|
|
9
|
+
|
|
10
|
+
async function collectFeatures({
|
|
11
|
+
node,
|
|
12
|
+
parent
|
|
13
|
+
}) {
|
|
14
|
+
var _parent$raws$between;
|
|
15
|
+
|
|
16
|
+
const funcName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
17
|
+
|
|
18
|
+
if (funcName !== 'calc') {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const features = [];
|
|
23
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
24
|
+
let areAllValuesNumber = true;
|
|
25
|
+
|
|
26
|
+
for (const child of node.nodes) {
|
|
27
|
+
if (child.type === 'function') {
|
|
28
|
+
const funcName = child.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
29
|
+
|
|
30
|
+
if (funcName === 'calc') {
|
|
31
|
+
const index = offset + child.sourceIndex;
|
|
32
|
+
const endIndex = offset + child.sourceEndIndex;
|
|
33
|
+
features.push({
|
|
34
|
+
endIndex,
|
|
35
|
+
id: `types.calc.nested`,
|
|
36
|
+
index,
|
|
37
|
+
name: `Nested calc()`,
|
|
38
|
+
node: parent
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (child.type === 'word') {
|
|
44
|
+
const {
|
|
45
|
+
unit: unitName
|
|
46
|
+
} = (0, _postcssValueParser.unit)(child.value) || {
|
|
47
|
+
number: null,
|
|
48
|
+
unit: null
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (unitName != null && unitName !== '') {
|
|
52
|
+
areAllValuesNumber = false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (areAllValuesNumber) {
|
|
58
|
+
const index = offset + node.sourceIndex;
|
|
59
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
60
|
+
features.push({
|
|
61
|
+
endIndex,
|
|
62
|
+
id: `types.calc.number_values`,
|
|
63
|
+
index,
|
|
64
|
+
name: `<number> value with calc()`,
|
|
65
|
+
node: parent
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return features;
|
|
70
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
|
|
8
|
+
var _postcssValueParser = require("postcss-value-parser");
|
|
9
|
+
|
|
10
|
+
var _function_name_map = require("./function_name_map");
|
|
11
|
+
|
|
12
|
+
var _unit_name_map = require("./unit_name_map");
|
|
13
|
+
|
|
14
|
+
var _value_name_map = require("./value_name_map");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
async function collectFeatures({
|
|
21
|
+
nodes,
|
|
22
|
+
parent
|
|
23
|
+
}) {
|
|
24
|
+
var _parent$raws$between;
|
|
25
|
+
|
|
26
|
+
const promises = [];
|
|
27
|
+
const features = [];
|
|
28
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
29
|
+
(0, _postcssValueParser.walk)(nodes, node => {
|
|
30
|
+
if (node.type === 'function') {
|
|
31
|
+
const functionName = node.value;
|
|
32
|
+
|
|
33
|
+
const featureId = _function_name_map.functionNameMap.get(functionName);
|
|
34
|
+
|
|
35
|
+
if (featureId != null) {
|
|
36
|
+
const index = offset + node.sourceIndex;
|
|
37
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
38
|
+
features.push({
|
|
39
|
+
endIndex,
|
|
40
|
+
id: featureId,
|
|
41
|
+
index,
|
|
42
|
+
name: `"${functionName}()" function`,
|
|
43
|
+
node: parent
|
|
44
|
+
});
|
|
45
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./__function/collect_features"))).then(({
|
|
46
|
+
collectFeatures
|
|
47
|
+
}) => {
|
|
48
|
+
return collectFeatures({
|
|
49
|
+
functionName,
|
|
50
|
+
node,
|
|
51
|
+
parent
|
|
52
|
+
});
|
|
53
|
+
}));
|
|
54
|
+
} else {
|
|
55
|
+
const functionName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
56
|
+
|
|
57
|
+
const featureId = _function_name_map.functionNameMap.get(functionName);
|
|
58
|
+
|
|
59
|
+
if (featureId != null) {
|
|
60
|
+
const index = offset + node.sourceIndex;
|
|
61
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
62
|
+
features.push({
|
|
63
|
+
endIndex,
|
|
64
|
+
id: featureId,
|
|
65
|
+
index,
|
|
66
|
+
name: `"${functionName}()" function`,
|
|
67
|
+
node: parent
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./__function/collect_features"))).then(({
|
|
72
|
+
collectFeatures
|
|
73
|
+
}) => {
|
|
74
|
+
return collectFeatures({
|
|
75
|
+
functionName,
|
|
76
|
+
node,
|
|
77
|
+
parent
|
|
78
|
+
});
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (node.type === 'word') {
|
|
84
|
+
const dimension = (0, _postcssValueParser.unit)(node.value);
|
|
85
|
+
|
|
86
|
+
if (dimension !== false) {
|
|
87
|
+
const featureId = _unit_name_map.unitNameMap.get(dimension.unit);
|
|
88
|
+
|
|
89
|
+
if (featureId != null) {
|
|
90
|
+
const index = offset + node.sourceIndex + dimension.number.length;
|
|
91
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
92
|
+
features.push({
|
|
93
|
+
endIndex,
|
|
94
|
+
id: featureId,
|
|
95
|
+
index,
|
|
96
|
+
name: `"${dimension.unit}" unit`,
|
|
97
|
+
node: parent
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./number/scientific_notation/collect_features"))).then(({
|
|
102
|
+
collectFeatures
|
|
103
|
+
}) => {
|
|
104
|
+
return collectFeatures({
|
|
105
|
+
dimension,
|
|
106
|
+
node,
|
|
107
|
+
parent
|
|
108
|
+
});
|
|
109
|
+
}));
|
|
110
|
+
} else {
|
|
111
|
+
const featureId = _value_name_map.valueNameMap.get(node.value);
|
|
112
|
+
|
|
113
|
+
if (featureId != null) {
|
|
114
|
+
const index = offset + node.sourceIndex;
|
|
115
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
116
|
+
features.push({
|
|
117
|
+
endIndex,
|
|
118
|
+
id: featureId,
|
|
119
|
+
index,
|
|
120
|
+
name: `"${node.value}" value`,
|
|
121
|
+
node: parent
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (/^#[0-9A-Fa-f]{3,8}$/.test(node.value)) {
|
|
126
|
+
promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./color/rgb_hexadecimal_notation/collect_features"))).then(({
|
|
127
|
+
collectFeatures
|
|
128
|
+
}) => {
|
|
129
|
+
return collectFeatures({
|
|
130
|
+
node,
|
|
131
|
+
parent
|
|
132
|
+
});
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return [...features, ...(await Promise.all(promises)).flat()];
|
|
139
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
const FUNCTION_NAME_LIST = ['hsl', 'rgb'];
|
|
8
|
+
|
|
9
|
+
async function collectFeatures({
|
|
10
|
+
node,
|
|
11
|
+
parent
|
|
12
|
+
}) {
|
|
13
|
+
var _parent$raws$between, _node$nodes$, _node$nodes$2, _node$nodes$3, _node$nodes$4, _node$nodes$5, _node$nodes$6, _node$nodes$7, _node$nodes$8, _node$nodes$9;
|
|
14
|
+
|
|
15
|
+
const funcName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
16
|
+
|
|
17
|
+
if (!FUNCTION_NAME_LIST.includes(funcName)) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const features = [];
|
|
22
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
23
|
+
|
|
24
|
+
if (node.nodes.length === 7 && ((_node$nodes$ = node.nodes[0]) === null || _node$nodes$ === void 0 ? void 0 : _node$nodes$.type) === 'word' && (((_node$nodes$2 = node.nodes[1]) === null || _node$nodes$2 === void 0 ? void 0 : _node$nodes$2.type) === 'space' || ((_node$nodes$3 = node.nodes[1]) === null || _node$nodes$3 === void 0 ? void 0 : _node$nodes$3.type) === 'div') && ((_node$nodes$4 = node.nodes[2]) === null || _node$nodes$4 === void 0 ? void 0 : _node$nodes$4.type) === 'word' && (((_node$nodes$5 = node.nodes[3]) === null || _node$nodes$5 === void 0 ? void 0 : _node$nodes$5.type) === 'space' || ((_node$nodes$6 = node.nodes[3]) === null || _node$nodes$6 === void 0 ? void 0 : _node$nodes$6.type) === 'div') && ((_node$nodes$7 = node.nodes[4]) === null || _node$nodes$7 === void 0 ? void 0 : _node$nodes$7.type) === 'word' && ((_node$nodes$8 = node.nodes[5]) === null || _node$nodes$8 === void 0 ? void 0 : _node$nodes$8.type) === 'div' && ((_node$nodes$9 = node.nodes[6]) === null || _node$nodes$9 === void 0 ? void 0 : _node$nodes$9.type) === 'word') {
|
|
25
|
+
const index = offset + node.sourceIndex;
|
|
26
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
27
|
+
features.push({
|
|
28
|
+
endIndex,
|
|
29
|
+
id: `types.color.${funcName}.alpha_parameter`,
|
|
30
|
+
index,
|
|
31
|
+
name: `Alpha parameter passed to ${funcName}()`,
|
|
32
|
+
node: parent
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return features;
|
|
37
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
|
|
8
|
+
var _postcssValueParser = require("postcss-value-parser");
|
|
9
|
+
|
|
10
|
+
const FUNCTION_NAME_LIST = ['rgb', 'rgba'];
|
|
11
|
+
|
|
12
|
+
async function collectFeatures({
|
|
13
|
+
node,
|
|
14
|
+
parent
|
|
15
|
+
}) {
|
|
16
|
+
var _parent$raws$between, _node$nodes$, _node$nodes$2, _node$nodes$3;
|
|
17
|
+
|
|
18
|
+
const funcName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
19
|
+
|
|
20
|
+
if (!FUNCTION_NAME_LIST.includes(funcName)) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const features = [];
|
|
25
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
26
|
+
|
|
27
|
+
if (node.nodes.length >= 5 && ((_node$nodes$ = node.nodes[0]) === null || _node$nodes$ === void 0 ? void 0 : _node$nodes$.type) === 'word' && ((_node$nodes$2 = node.nodes[2]) === null || _node$nodes$2 === void 0 ? void 0 : _node$nodes$2.type) === 'word' && ((_node$nodes$3 = node.nodes[4]) === null || _node$nodes$3 === void 0 ? void 0 : _node$nodes$3.type) === 'word') {
|
|
28
|
+
const includedFloatUnit = [node.nodes[0].value, node.nodes[2].value, node.nodes[4].value].map(v => (0, _postcssValueParser.unit)(v)).some(t => t !== false && /^[0-9]+$/.test(t.number) === false);
|
|
29
|
+
|
|
30
|
+
if (includedFloatUnit) {
|
|
31
|
+
const index = offset + node.sourceIndex;
|
|
32
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
33
|
+
features.push({
|
|
34
|
+
endIndex,
|
|
35
|
+
id: `types.color.${funcName}.float_values`,
|
|
36
|
+
index,
|
|
37
|
+
name: `Float values in ${funcName}() parameters`,
|
|
38
|
+
node: parent
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return features;
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
const FUNCTION_NAME_LIST = ['hsl', 'hsla', 'rgb', 'rgba'];
|
|
8
|
+
|
|
9
|
+
async function collectFeatures({
|
|
10
|
+
node,
|
|
11
|
+
parent
|
|
12
|
+
}) {
|
|
13
|
+
var _parent$raws$between, _node$nodes$, _node$nodes$2, _node$nodes$3, _node$nodes$4, _node$nodes$5;
|
|
14
|
+
|
|
15
|
+
const funcName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
16
|
+
|
|
17
|
+
if (!FUNCTION_NAME_LIST.includes(funcName)) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const features = [];
|
|
22
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
23
|
+
|
|
24
|
+
if (node.nodes.length === 5 && ((_node$nodes$ = node.nodes[1]) === null || _node$nodes$ === void 0 ? void 0 : _node$nodes$.type) === 'space' && ((_node$nodes$2 = node.nodes[3]) === null || _node$nodes$2 === void 0 ? void 0 : _node$nodes$2.type) === 'space' || node.nodes.length === 7 && ((_node$nodes$3 = node.nodes[1]) === null || _node$nodes$3 === void 0 ? void 0 : _node$nodes$3.type) === 'space' && ((_node$nodes$4 = node.nodes[3]) === null || _node$nodes$4 === void 0 ? void 0 : _node$nodes$4.type) === 'space' && ((_node$nodes$5 = node.nodes[5]) === null || _node$nodes$5 === void 0 ? void 0 : _node$nodes$5.type) === 'div' && node.nodes[5].value === '/') {
|
|
25
|
+
const index = offset + node.sourceIndex;
|
|
26
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
27
|
+
features.push({
|
|
28
|
+
endIndex,
|
|
29
|
+
id: `types.color.${funcName}.space_separated_parameters`,
|
|
30
|
+
index,
|
|
31
|
+
name: `Space-separated ${funcName}() parameters`,
|
|
32
|
+
node: parent
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return features;
|
|
37
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
|
|
8
|
+
async function collectFeatures({
|
|
9
|
+
node,
|
|
10
|
+
parent
|
|
11
|
+
}) {
|
|
12
|
+
var _parent$raws$between;
|
|
13
|
+
|
|
14
|
+
const features = [];
|
|
15
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
16
|
+
|
|
17
|
+
if (/^#[0-9A-Fa-f]{3}$/.test(node.value) || /^#[0-9A-Fa-f]{6}$/.test(node.value)) {
|
|
18
|
+
const index = offset + node.sourceIndex;
|
|
19
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
20
|
+
features.push({
|
|
21
|
+
endIndex,
|
|
22
|
+
id: `types.color.rgb_hexadecimal_notation`,
|
|
23
|
+
index,
|
|
24
|
+
name: `RGB hexadecimal notation`,
|
|
25
|
+
node: parent
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (/^#[0-9A-Fa-f]{4}$/.test(node.value) || /^#[0-9A-Fa-f]{8}$/.test(node.value)) {
|
|
30
|
+
const index = offset + node.sourceIndex;
|
|
31
|
+
const endIndex = offset + node.sourceEndIndex;
|
|
32
|
+
features.push({
|
|
33
|
+
endIndex,
|
|
34
|
+
id: `types.color.rgb_hexadecimal_notation.alpha_hexadecimal_notation`,
|
|
35
|
+
index,
|
|
36
|
+
name: `RGBA hexadecimal notation`,
|
|
37
|
+
node: parent
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return features;
|
|
42
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectFeatures = collectFeatures;
|
|
7
|
+
const JUMP_TERM_WORD_LIST = ['jump-start', 'jump-end', 'jump-none', 'jump-both'];
|
|
8
|
+
|
|
9
|
+
async function collectFeatures({
|
|
10
|
+
node,
|
|
11
|
+
parent
|
|
12
|
+
}) {
|
|
13
|
+
var _parent$raws$between, _node$nodes$;
|
|
14
|
+
|
|
15
|
+
const funcName = node.value.replace(/^-(?:ms|o|webkit|moz)-/, '');
|
|
16
|
+
|
|
17
|
+
if (funcName !== 'steps') {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const features = [];
|
|
22
|
+
const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
|
|
23
|
+
|
|
24
|
+
if (((_node$nodes$ = node.nodes[2]) === null || _node$nodes$ === void 0 ? void 0 : _node$nodes$.type) === 'word' && JUMP_TERM_WORD_LIST.includes(node.nodes[2].value)) {
|
|
25
|
+
const index = offset + node.nodes[2].sourceIndex;
|
|
26
|
+
const endIndex = offset + node.nodes[2].sourceEndIndex;
|
|
27
|
+
features.push({
|
|
28
|
+
endIndex,
|
|
29
|
+
id: `types.easing-function.steps.jump`,
|
|
30
|
+
index,
|
|
31
|
+
name: `"${node.nodes[2].value}" keyword for steps()`,
|
|
32
|
+
node: parent
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return features;
|
|
37
|
+
}
|