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.
Files changed (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/lib/at-rules/at_rules_name_set.js +16 -0
  4. package/lib/at-rules/collect_features.js +145 -0
  5. package/lib/at-rules/counter-style/collect_features.js +41 -0
  6. package/lib/at-rules/counter-style/descriptor_name_set.js +16 -0
  7. package/lib/at-rules/document/collect_features.js +46 -0
  8. package/lib/at-rules/document/regexp/collect_features.js +30 -0
  9. package/lib/at-rules/font-face/__font_type/collect_features.js +79 -0
  10. package/lib/at-rules/font-face/collect_features.js +67 -0
  11. package/lib/at-rules/font-face/descriptor_name_set.js +16 -0
  12. package/lib/at-rules/font-feature-values/at_rules_name_set.js +16 -0
  13. package/lib/at-rules/font-feature-values/collect_features.js +30 -0
  14. package/lib/at-rules/keyframes/collect_features.js +29 -0
  15. package/lib/at-rules/media/collect_features.js +118 -0
  16. package/lib/at-rules/media/media_feature_name_map.js +8 -0
  17. package/lib/at-rules/page/collect_features.js +82 -0
  18. package/lib/at-rules/page/descriptor_name_set.js +16 -0
  19. package/lib/at-rules/page/size/collect_features.js +55 -0
  20. package/lib/at-rules/property/collect_features.js +60 -0
  21. package/lib/at-rules/property/descriptor_name_set.js +16 -0
  22. package/lib/at-rules/scroll-timeline/collect_features.js +60 -0
  23. package/lib/at-rules/scroll-timeline/descriptor_name_set.js +16 -0
  24. package/lib/collect_features.js +69 -0
  25. package/lib/index.js +5 -0
  26. package/lib/is_supported.js +75 -0
  27. package/lib/options.js +20 -0
  28. package/lib/parse_browserslist_version.js +132 -0
  29. package/lib/properties/-moz-orient/collect_features.js +61 -0
  30. package/lib/properties/-moz-user-input/collect_features.js +71 -0
  31. package/lib/properties/animation-direction/collect_features.js +53 -0
  32. package/lib/properties/animation-timing-function/collect_features.js +51 -0
  33. package/lib/properties/appearance/collect_features.js +76 -0
  34. package/lib/properties/background/background-clip/collect_features.js +59 -0
  35. package/lib/properties/background/background-origin/collect_features.js +59 -0
  36. package/lib/properties/background/background-size/collect_features.js +106 -0
  37. package/lib/properties/background/collect_features.js +104 -0
  38. package/lib/properties/background/multiple_backgrounds/collect_features.js +39 -0
  39. package/lib/properties/background-attachment/collect_features.js +70 -0
  40. package/lib/properties/background-clip/collect_features.js +55 -0
  41. package/lib/properties/background-image/collect_features.js +133 -0
  42. package/lib/properties/background-image/svg_images/collect_features.js +58 -0
  43. package/lib/properties/background-origin/collect_features.js +42 -0
  44. package/lib/properties/background-position/collect_features.js +117 -0
  45. package/lib/properties/background-position-x/collect_features.js +36 -0
  46. package/lib/properties/background-position-y/collect_features.js +36 -0
  47. package/lib/properties/background-repeat/collect_features.js +102 -0
  48. package/lib/properties/background-repeat/round_space/collect_features.js +54 -0
  49. package/lib/properties/background-size/collect_features.js +38 -0
  50. package/lib/properties/block-size/collect_features.js +77 -0
  51. package/lib/properties/border-bottom-left-radius/border-bottom-right-radius/collect_features.js +57 -0
  52. package/lib/properties/border-bottom-left-radius/collect_features.js +57 -0
  53. package/lib/properties/border-bottom-right-radius/collect_features.js +57 -0
  54. package/lib/properties/border-radius/collect_features.js +61 -0
  55. package/lib/properties/border-top-left-radius/collect_features.js +57 -0
  56. package/lib/properties/border-top-right-radius/collect_features.js +57 -0
  57. package/lib/properties/box-shadow/collect_features.js +92 -0
  58. package/lib/properties/box-sizing/collect_features.js +39 -0
  59. package/lib/properties/caption-side/collect_features.js +38 -0
  60. package/lib/properties/clear/collect_features.js +38 -0
  61. package/lib/properties/clip-path/collect_features.js +65 -0
  62. package/lib/properties/collect_features.js +452 -0
  63. package/lib/properties/color-scheme/collect_features.js +52 -0
  64. package/lib/properties/property_name_set.js +16 -0
  65. package/lib/properties/transition/collect_features.js +33 -0
  66. package/lib/properties/transition-property/collect_features.js +38 -0
  67. package/lib/rule.js +125 -0
  68. package/lib/selectors/__attributes/collect_features.js +44 -0
  69. package/lib/selectors/__classes/collect_features.js +23 -0
  70. package/lib/selectors/__combinators/collect_features.js +91 -0
  71. package/lib/selectors/__ids/collect_features.js +23 -0
  72. package/lib/selectors/__pseudos/collect_features.js +228 -0
  73. package/lib/selectors/__pseudos/pseudo_selector_name_set.js +18 -0
  74. package/lib/selectors/__tags/collect_features.js +48 -0
  75. package/lib/selectors/__universal/collect_features.js +37 -0
  76. package/lib/selectors/active/non_a_elements/collect_features.js +38 -0
  77. package/lib/selectors/after/animation_and_transition_support/collect_features.js +43 -0
  78. package/lib/selectors/backdrop/dialog/collect_features.js +38 -0
  79. package/lib/selectors/before/animation_and_transition_support/collect_features.js +43 -0
  80. package/lib/selectors/collect_features.js +120 -0
  81. package/lib/selectors/cue/selector_argument/collect_features.js +26 -0
  82. package/lib/selectors/hostfunction/collect_features.js +26 -0
  83. package/lib/selectors/hover/collect_features.js +61 -0
  84. package/lib/selectors/invalid/collect_features.js +39 -0
  85. package/lib/selectors/marker/animation_and_transition_support/collect_features.js +43 -0
  86. package/lib/selectors/not/selector_list/collect_features.js +31 -0
  87. package/lib/selectors/nth-child/of_syntax/collect_features.js +32 -0
  88. package/lib/selectors/nth-last-child/of_syntax/collect_features.js +32 -0
  89. package/lib/selectors/valid/collect_features.js +39 -0
  90. package/lib/types/__function/collect_features.js +187 -0
  91. package/lib/types/attr/collect_features.js +69 -0
  92. package/lib/types/attr/type_unit_name_map.js +8 -0
  93. package/lib/types/calc/collect_features.js +70 -0
  94. package/lib/types/collect_features.js +139 -0
  95. package/lib/types/color/__alpha_parameter/collect_features.js +37 -0
  96. package/lib/types/color/__float_values/collect_features.js +44 -0
  97. package/lib/types/color/__space_separated_parameters/collect_features.js +37 -0
  98. package/lib/types/color/rgb_hexadecimal_notation/collect_features.js +42 -0
  99. package/lib/types/easing-function/steps/jump/collect_features.js +37 -0
  100. package/lib/types/function_name_map.js +8 -0
  101. package/lib/types/image/gradient/__linear-gradient/collect_features.js +77 -0
  102. package/lib/types/image/gradient/__linear-gradient/doubleposition/collect_features.js +43 -0
  103. package/lib/types/image/gradient/__linear-gradient/interpolation_hints/collect_features.js +42 -0
  104. package/lib/types/image/gradient/__linear-gradient/to/collect_features.js +39 -0
  105. package/lib/types/image/gradient/__linear-gradient/unitless_0_angle/collect_features.js +40 -0
  106. package/lib/types/image/gradient/__radial-gradient/at/collect_features.js +44 -0
  107. package/lib/types/image/gradient/__radial-gradient/collect_features.js +68 -0
  108. package/lib/types/image/gradient/__radial-gradient/doubleposition/collect_features.js +47 -0
  109. package/lib/types/image/gradient/__radial-gradient/interpolation_hints/collect_features.js +42 -0
  110. package/lib/types/image/gradient/conic-gradient/collect_features.js +48 -0
  111. package/lib/types/image/gradient/conic-gradient/doubleposition/collect_features.js +43 -0
  112. package/lib/types/number/scientific_notation/collect_features.js +31 -0
  113. package/lib/types/unit_name_map.js +8 -0
  114. package/lib/types/value_name_map.js +8 -0
  115. package/lib/types.js +5 -0
  116. package/package.json +75 -0
@@ -0,0 +1,104 @@
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
+ nodes,
14
+ parent
15
+ }) {
16
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
17
+
18
+ if (prop !== 'background') {
19
+ return [];
20
+ }
21
+
22
+ const promises = [];
23
+ const bgLayerList = [[]];
24
+
25
+ for (const node of nodes) {
26
+ if (node.type === 'div' && node.value === ',') {
27
+ bgLayerList.push([]);
28
+ } else {
29
+ const bgLayer = bgLayerList[bgLayerList.length - 1];
30
+ bgLayer === null || bgLayer === void 0 ? void 0 : bgLayer.push(node);
31
+ }
32
+ }
33
+
34
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./multiple_backgrounds/collect_features"))).then(({
35
+ collectFeatures
36
+ }) => {
37
+ return collectFeatures({
38
+ nodes,
39
+ parent
40
+ });
41
+ }));
42
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./background-size/collect_features"))).then(({
43
+ collectFeatures
44
+ }) => {
45
+ return collectFeatures({
46
+ bgLayerList,
47
+ parent
48
+ });
49
+ }));
50
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./background-clip/collect_features"))).then(({
51
+ collectFeatures
52
+ }) => {
53
+ return collectFeatures({
54
+ bgLayerList,
55
+ parent
56
+ });
57
+ }));
58
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./background-origin/collect_features"))).then(({
59
+ collectFeatures
60
+ }) => {
61
+ return collectFeatures({
62
+ bgLayerList,
63
+ parent
64
+ });
65
+ }));
66
+
67
+ for (const bgLayer of bgLayerList) {
68
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../background-attachment/collect_features"))).then(({
69
+ collectFeatures
70
+ }) => {
71
+ return collectFeatures({
72
+ nodes: bgLayer,
73
+ parent
74
+ });
75
+ }));
76
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../background-image/collect_features"))).then(({
77
+ collectFeatures
78
+ }) => {
79
+ return collectFeatures({
80
+ nodes: bgLayer,
81
+ parent
82
+ });
83
+ }));
84
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../background-position/collect_features"))).then(({
85
+ collectFeatures
86
+ }) => {
87
+ return collectFeatures({
88
+ nodes: bgLayer,
89
+ parent
90
+ });
91
+ }));
92
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("../background-repeat/collect_features"))).then(({
93
+ collectFeatures
94
+ }) => {
95
+ return collectFeatures({
96
+ nodes: bgLayer,
97
+ parent
98
+ });
99
+ }));
100
+ }
101
+
102
+ const features = (await Promise.all(promises)).flat();
103
+ return features;
104
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectFeatures = collectFeatures;
7
+
8
+ async function collectFeatures({
9
+ nodes,
10
+ parent
11
+ }) {
12
+ var _parent$raws$between;
13
+
14
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
15
+
16
+ if (prop !== 'background') {
17
+ return [];
18
+ }
19
+
20
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
21
+ const features = [];
22
+
23
+ for (const node of nodes) {
24
+ if (node.type === 'div' && node.value === ',') {
25
+ const index = offset;
26
+ const endIndex = offset + parent.value.length;
27
+ features.push({
28
+ endIndex,
29
+ id: `properties.background.multiple_backgrounds`,
30
+ index,
31
+ name: `Multiple backgrounds`,
32
+ node: parent
33
+ });
34
+ break;
35
+ }
36
+ }
37
+
38
+ return features;
39
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectFeatures = collectFeatures;
7
+
8
+ async function collectFeatures({
9
+ nodes,
10
+ parent
11
+ }) {
12
+ var _parent$raws$between;
13
+
14
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
15
+
16
+ if (prop !== 'background' && prop !== 'background-attachment') {
17
+ return [];
18
+ }
19
+
20
+ const features = [];
21
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
22
+ let isMultipleBackground = false;
23
+
24
+ for (const node of nodes) {
25
+ if (node.type === 'div' && node.value === ',') {
26
+ isMultipleBackground = true;
27
+ continue;
28
+ }
29
+
30
+ if (node.type !== 'word') {
31
+ continue;
32
+ }
33
+
34
+ if (node.value === 'fixed') {
35
+ const index = offset + node.sourceIndex;
36
+ const endIndex = offset + node.sourceEndIndex;
37
+ features.push({
38
+ endIndex,
39
+ id: `properties.background-attachment.fixed`,
40
+ index,
41
+ name: `"fixed" value specified as background-attachment`,
42
+ node: parent
43
+ });
44
+ } else if (node.value === 'local') {
45
+ const index = offset + node.sourceIndex;
46
+ const endIndex = offset + node.sourceEndIndex;
47
+ features.push({
48
+ endIndex,
49
+ id: `properties.background-attachment.local`,
50
+ index,
51
+ name: `"local" value specified as background-attachment`,
52
+ node: parent
53
+ });
54
+ }
55
+ }
56
+
57
+ if (isMultipleBackground) {
58
+ const index = offset;
59
+ const endIndex = offset + parent.value.length;
60
+ features.push({
61
+ endIndex,
62
+ id: `properties.background-attachment.multiple_backgrounds`,
63
+ index,
64
+ name: `Multiple backgrounds`,
65
+ node: parent
66
+ });
67
+ }
68
+
69
+ return features;
70
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectFeatures = collectFeatures;
7
+
8
+ async function collectFeatures({
9
+ nodes,
10
+ parent
11
+ }) {
12
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
13
+
14
+ if (prop !== 'background' && prop !== 'background-clip') {
15
+ return [];
16
+ }
17
+
18
+ const features = [];
19
+
20
+ for (const node of nodes) {
21
+ if (node.type !== 'word') {
22
+ continue;
23
+ }
24
+
25
+ if (node.value === 'content-box') {
26
+ var _parent$raws$between;
27
+
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
+ const index = offset + node.sourceIndex;
30
+ const endIndex = offset + node.sourceEndIndex;
31
+ features.push({
32
+ endIndex,
33
+ id: `properties.background-clip.content-box`,
34
+ index,
35
+ name: `"content-box" value specified as background-clip`,
36
+ node: parent
37
+ });
38
+ } else if (node.value === 'text') {
39
+ var _parent$raws$between2;
40
+
41
+ const offset = parent.prop.length + (((_parent$raws$between2 = parent.raws.between) === null || _parent$raws$between2 === void 0 ? void 0 : _parent$raws$between2.length) ?? 0);
42
+ const index = offset + node.sourceIndex;
43
+ const endIndex = offset + node.sourceEndIndex;
44
+ features.push({
45
+ endIndex,
46
+ id: `properties.background-clip.text`,
47
+ index,
48
+ name: `"text" value specified as background-clip`,
49
+ node: parent
50
+ });
51
+ }
52
+ }
53
+
54
+ return features;
55
+ }
@@ -0,0 +1,133 @@
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
+ nodes,
14
+ parent
15
+ }) {
16
+ var _parent$raws$between;
17
+
18
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
19
+
20
+ if (prop !== 'background' && prop !== 'background-image') {
21
+ return [];
22
+ }
23
+
24
+ const promises = [];
25
+ const features = [];
26
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
27
+ let isMultipleBackground = false;
28
+
29
+ for (const node of nodes) {
30
+ if (node.type === 'div' && node.value === ',') {
31
+ isMultipleBackground = true;
32
+ continue;
33
+ }
34
+
35
+ if (node.type !== 'function') {
36
+ continue;
37
+ }
38
+
39
+ const funcName = node.value.replace(/^-(webkit|moz|ms|o)-/, '');
40
+ const index = offset + node.sourceIndex;
41
+ const endIndex = offset + node.sourceEndIndex;
42
+
43
+ switch (funcName) {
44
+ case 'element':
45
+ {
46
+ features.push({
47
+ endIndex,
48
+ id: `properties.background-image.element`,
49
+ index,
50
+ name: `"element()" function specified as background-image`,
51
+ node: parent
52
+ });
53
+ break;
54
+ }
55
+
56
+ case 'conic-gradient':
57
+ case 'linear-gradient':
58
+ case 'radial-gradient':
59
+ case 'repeating-conic-gradient':
60
+ case 'repeating-linear-gradient':
61
+ case 'repeating-radial-gradient':
62
+ {
63
+ features.push({
64
+ endIndex,
65
+ id: `properties.background-image.gradients`,
66
+ index,
67
+ name: `Gradient function specified as background-image`,
68
+ node: parent
69
+ });
70
+ break;
71
+ }
72
+
73
+ case 'image-rect':
74
+ {
75
+ features.push({
76
+ endIndex,
77
+ id: `properties.background-image.image-rect`,
78
+ index,
79
+ name: `"image-rect()" function specified as background-image`,
80
+ node: parent
81
+ });
82
+ break;
83
+ }
84
+
85
+ case 'image-set':
86
+ {
87
+ features.push({
88
+ endIndex,
89
+ id: `properties.background-image.image-set`,
90
+ index,
91
+ name: `"image-set()" function specified as background-image`,
92
+ node: parent
93
+ });
94
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./svg_images/collect_features"))).then(({
95
+ collectFeatures
96
+ }) => {
97
+ return collectFeatures({
98
+ nodes: node.nodes,
99
+ parent
100
+ });
101
+ }));
102
+ break;
103
+ }
104
+
105
+ case 'url':
106
+ {
107
+ promises.push(Promise.resolve().then(() => _interopRequireWildcard(require("./svg_images/collect_features"))).then(({
108
+ collectFeatures
109
+ }) => {
110
+ return collectFeatures({
111
+ nodes: [node],
112
+ parent
113
+ });
114
+ }));
115
+ break;
116
+ }
117
+ }
118
+ }
119
+
120
+ if (isMultipleBackground) {
121
+ const index = offset;
122
+ const endIndex = offset + parent.value.length;
123
+ features.push({
124
+ endIndex,
125
+ id: `properties.background-image.multiple_backgrounds`,
126
+ index,
127
+ name: `Multiple backgrounds`,
128
+ node: parent
129
+ });
130
+ }
131
+
132
+ return [...features, ...(await Promise.all(promises)).flat()];
133
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectFeatures = collectFeatures;
7
+
8
+ var _nodePath = _interopRequireDefault(require("node:path"));
9
+
10
+ var _tsResults = require("ts-results");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ async function collectFeatures({
15
+ nodes,
16
+ parent
17
+ }) {
18
+ var _parent$raws$between;
19
+
20
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
21
+
22
+ if (prop !== 'background' && prop !== 'background-image') {
23
+ return [];
24
+ }
25
+
26
+ const features = [];
27
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
28
+
29
+ for (const node of nodes) {
30
+ if (node.type !== 'function' || node.value !== 'url' || node.nodes.length !== 1 || node.nodes[0] == null) {
31
+ continue;
32
+ }
33
+
34
+ const urlPathNode = node.nodes[0];
35
+
36
+ const url = _tsResults.Result.wrap(() => new URL(urlPathNode.value, 'https://example.com/')).unwrapOr(null);
37
+
38
+ if (url == null || url.protocol !== 'http:' && url.protocol !== 'https:') {
39
+ continue;
40
+ }
41
+
42
+ const extension = _nodePath.default.extname(url.pathname);
43
+
44
+ if (extension === '.svg') {
45
+ const index = offset + urlPathNode.sourceIndex;
46
+ const endIndex = offset + urlPathNode.sourceEndIndex;
47
+ features.push({
48
+ endIndex,
49
+ id: `properties.background-image.svg_images`,
50
+ index,
51
+ name: `SVG image as background-image`,
52
+ node: parent
53
+ });
54
+ }
55
+ }
56
+
57
+ return features;
58
+ }
@@ -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
+ nodes,
10
+ parent
11
+ }) {
12
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
13
+
14
+ if (prop !== 'background' && prop !== 'background-origin') {
15
+ return [];
16
+ }
17
+
18
+ const features = [];
19
+
20
+ for (const node of nodes) {
21
+ if (node.type !== 'word') {
22
+ continue;
23
+ }
24
+
25
+ if (node.value === 'content-box') {
26
+ var _parent$raws$between;
27
+
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
+ const index = offset + node.sourceIndex;
30
+ const endIndex = offset + node.sourceEndIndex;
31
+ features.push({
32
+ endIndex,
33
+ id: `properties.background-origin.content-box`,
34
+ index,
35
+ name: `"content-box" value specified as background-origin`,
36
+ node: parent
37
+ });
38
+ }
39
+ }
40
+
41
+ return features;
42
+ }
@@ -0,0 +1,117 @@
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 POSITION_KEYWORD_LIST = ['top', 'bottom', 'left', 'right', 'center'];
11
+
12
+ function isPositionValue(node) {
13
+ if (node == null) {
14
+ return false;
15
+ }
16
+
17
+ if (node.type === 'word') {
18
+ if (POSITION_KEYWORD_LIST.includes(node.value)) {
19
+ return true;
20
+ }
21
+
22
+ if ((0, _postcssValueParser.unit)(node.value) !== false) {
23
+ return true;
24
+ }
25
+ }
26
+
27
+ if (node.type === 'function' && node.value === 'calc') {
28
+ return true;
29
+ }
30
+
31
+ return false;
32
+ }
33
+
34
+ async function collectFeatures({
35
+ nodes,
36
+ parent
37
+ }) {
38
+ var _parent$raws$between;
39
+
40
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
41
+
42
+ if (prop !== 'background' && prop !== 'background-position') {
43
+ return [];
44
+ }
45
+
46
+ const features = [];
47
+ const bgPositionList = [[]];
48
+ {
49
+ let isAfterSlash = false;
50
+
51
+ for (const node of nodes) {
52
+ if (node.type === 'div' && node.value === ',') {
53
+ bgPositionList.push([]);
54
+ isAfterSlash = false;
55
+ } else if (node.type === 'div' && node.value === '/') {
56
+ isAfterSlash = true;
57
+ } else if (!isAfterSlash) {
58
+ const bgPosition = bgPositionList[bgPositionList.length - 1];
59
+ bgPosition === null || bgPosition === void 0 ? void 0 : bgPosition.push(node);
60
+ }
61
+ }
62
+ }
63
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
64
+
65
+ if (bgPositionList.length >= 2) {
66
+ const index = offset;
67
+ const endIndex = offset + parent.value.length;
68
+ features.push({
69
+ endIndex,
70
+ id: `properties.background-position.multiple_backgrounds`,
71
+ index,
72
+ name: `Multiple backgrounds`,
73
+ node: parent
74
+ });
75
+ }
76
+
77
+ for (const bgPosition of bgPositionList) {
78
+ for (let idx = 0; idx < bgPosition.length; idx++) {
79
+ const first = bgPosition[idx]; // const second = bgPosition[idx + 2];
80
+
81
+ const third = bgPosition[idx + 4];
82
+ const fourth = bgPosition[idx + 6];
83
+
84
+ if (!isPositionValue(first)) {
85
+ continue;
86
+ }
87
+
88
+ if (isPositionValue(fourth)) {
89
+ const index = offset + first.sourceIndex;
90
+ const endIndex = offset + fourth.sourceEndIndex;
91
+ features.push({
92
+ endIndex,
93
+ id: `properties.background-position.4_value_syntax`,
94
+ index,
95
+ name: `Offset values from any edge specified as background-position`,
96
+ node: parent
97
+ });
98
+ break;
99
+ }
100
+
101
+ if (isPositionValue(third)) {
102
+ const index = offset + first.sourceIndex;
103
+ const endIndex = offset + third.sourceEndIndex;
104
+ features.push({
105
+ endIndex,
106
+ id: `properties.background-position.4_value_syntax`,
107
+ index,
108
+ name: `Offset values from any edge specified as background-position`,
109
+ node: parent
110
+ });
111
+ break;
112
+ }
113
+ }
114
+ }
115
+
116
+ return features;
117
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectFeatures = collectFeatures;
7
+
8
+ async function collectFeatures({
9
+ nodes,
10
+ parent
11
+ }) {
12
+ var _parent$raws$between;
13
+
14
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
15
+
16
+ if (prop !== 'background-position-x') {
17
+ return [];
18
+ }
19
+
20
+ const features = [];
21
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
22
+
23
+ if (nodes.length >= 3) {
24
+ const index = offset;
25
+ const endIndex = offset + parent.value.length;
26
+ features.push({
27
+ endIndex,
28
+ id: `properties.background-position-x.two_value_syntax`,
29
+ index,
30
+ name: `Offset values from any edge specified as background-position-x`,
31
+ node: parent
32
+ });
33
+ }
34
+
35
+ return features;
36
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.collectFeatures = collectFeatures;
7
+
8
+ async function collectFeatures({
9
+ nodes,
10
+ parent
11
+ }) {
12
+ var _parent$raws$between;
13
+
14
+ const prop = parent.prop.replace(/^-(webkit|moz|ms|o)-/, '');
15
+
16
+ if (prop !== 'background-position-y') {
17
+ return [];
18
+ }
19
+
20
+ const features = [];
21
+ const offset = parent.prop.length + (((_parent$raws$between = parent.raws.between) === null || _parent$raws$between === void 0 ? void 0 : _parent$raws$between.length) ?? 0);
22
+
23
+ if (nodes.length >= 3) {
24
+ const index = offset;
25
+ const endIndex = offset + parent.value.length;
26
+ features.push({
27
+ endIndex,
28
+ id: `properties.background-position-y.2_value_syntax`,
29
+ index,
30
+ name: `Offset values from any edge specified as background-position-y`,
31
+ node: parent
32
+ });
33
+ }
34
+
35
+ return features;
36
+ }