@plumeria/eslint-plugin 0.19.2 → 0.19.3
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 +2 -2
- package/dist/index.d.ts +16 -0
- package/dist/index.js +48 -0
- package/dist/rules/no-destructure.d.ts +2 -0
- package/dist/rules/no-destructure.js +45 -0
- package/dist/rules/no-inner-call.d.ts +2 -0
- package/dist/rules/no-inner-call.js +65 -0
- package/dist/rules/no-unused-keys.d.ts +2 -0
- package/dist/rules/no-unused-keys.js +87 -0
- package/dist/rules/sort-properties.d.ts +2 -0
- package/dist/rules/sort-properties.js +114 -0
- package/dist/rules/validate-values.d.ts +2 -0
- package/dist/rules/validate-values.js +2073 -0
- package/dist/util/colorData.d.ts +2 -0
- package/dist/util/colorData.js +186 -0
- package/dist/util/place.d.ts +5 -0
- package/dist/util/place.js +230 -0
- package/dist/util/propertyGroups.d.ts +5 -0
- package/dist/util/propertyGroups.js +508 -0
- package/dist/util/unitData.d.ts +2 -0
- package/dist/util/unitData.js +37 -0
- package/dist/util/validData.d.ts +4 -0
- package/dist/util/validData.js +844 -0
- package/package.json +9 -4
- package/lib/index.d.ts +0 -19
- package/lib/index.js +0 -51
- package/lib/rules/no-destructure.js +0 -52
- package/lib/rules/no-inner-call.js +0 -69
- package/lib/rules/no-unused-keys.js +0 -111
- package/lib/rules/sort-properties.js +0 -131
- package/lib/rules/validate-values.js +0 -2479
- package/lib/util/colorData.js +0 -211
- package/lib/util/place.js +0 -306
- package/lib/util/propertyGroups.js +0 -557
- package/lib/util/unitData.js +0 -42
- package/lib/util/validData.js +0 -1052
|
@@ -1,2479 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview CSS 397 Properties valid value verification
|
|
3
|
-
* Compatible with eslint 8 and below or 9 and above
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
const validData = require('../util/validData');
|
|
9
|
-
const unitData = require('../util/unitData');
|
|
10
|
-
const { colorValue } = require('../util/colorData');
|
|
11
|
-
const {
|
|
12
|
-
isValidPlaceContent,
|
|
13
|
-
isValidPlaceItems,
|
|
14
|
-
isValidPlaceSelf,
|
|
15
|
-
isValidTouchAction,
|
|
16
|
-
} = require('../util/place');
|
|
17
|
-
|
|
18
|
-
const globalValues = ['inherit', 'initial', 'revert', 'revert-layer', 'unset'];
|
|
19
|
-
|
|
20
|
-
// single length percentage or no percentage value.
|
|
21
|
-
const lengthValueProperties = [
|
|
22
|
-
'width',
|
|
23
|
-
'maxWidth',
|
|
24
|
-
'minWidth',
|
|
25
|
-
'height',
|
|
26
|
-
'maxHeight',
|
|
27
|
-
'minHeight',
|
|
28
|
-
'blockSize',
|
|
29
|
-
'columnWidth',
|
|
30
|
-
'flexBasis',
|
|
31
|
-
'inlineSize',
|
|
32
|
-
'background',
|
|
33
|
-
'top',
|
|
34
|
-
'bottom',
|
|
35
|
-
'left',
|
|
36
|
-
'right',
|
|
37
|
-
'marginTop',
|
|
38
|
-
'marginBottom',
|
|
39
|
-
'marginLeft',
|
|
40
|
-
'marginRight',
|
|
41
|
-
'paddingTop',
|
|
42
|
-
'paddingBottom',
|
|
43
|
-
'paddingLeft',
|
|
44
|
-
'paddingRight',
|
|
45
|
-
'fontSize',
|
|
46
|
-
'lineHeight',
|
|
47
|
-
'insetBlockEnd',
|
|
48
|
-
'insetBlockStart',
|
|
49
|
-
'insetInlineEnd',
|
|
50
|
-
'insetInlineStart',
|
|
51
|
-
'marginBlockEnd',
|
|
52
|
-
'marginBlockStart',
|
|
53
|
-
'paddingBlockEnd',
|
|
54
|
-
'paddingBlockStart',
|
|
55
|
-
'paddingInlineEnd',
|
|
56
|
-
'paddingInlineStart',
|
|
57
|
-
'marginInlineEnd',
|
|
58
|
-
'marginInlineStart',
|
|
59
|
-
'maxBlockSize',
|
|
60
|
-
'minBlockSize',
|
|
61
|
-
'maxInlineSize',
|
|
62
|
-
'minInlineSize',
|
|
63
|
-
'offsetDistance',
|
|
64
|
-
//----
|
|
65
|
-
'borderTopWidth',
|
|
66
|
-
'borderBottomWidth',
|
|
67
|
-
'borderLeftWidth',
|
|
68
|
-
'borderRightWidth',
|
|
69
|
-
'borderBlockStartWidth',
|
|
70
|
-
'borderBlockEndWidth',
|
|
71
|
-
'borderInlineStartWidth',
|
|
72
|
-
'borderInlineEndWidth',
|
|
73
|
-
'columnRuleWidth',
|
|
74
|
-
'outlineOffset',
|
|
75
|
-
'perspective',
|
|
76
|
-
'letterSpacing',
|
|
77
|
-
'wordSpacing',
|
|
78
|
-
'tabSize',
|
|
79
|
-
//----
|
|
80
|
-
'columnGap',
|
|
81
|
-
'rowGap',
|
|
82
|
-
'rx',
|
|
83
|
-
'ry',
|
|
84
|
-
'scrollMarginBlockEnd',
|
|
85
|
-
'scrollMarginBlockStart',
|
|
86
|
-
'scrollMarginInlineEnd',
|
|
87
|
-
'scrollMarginInlineStart',
|
|
88
|
-
'scrollMarginBottom',
|
|
89
|
-
'scrollMarginLeft',
|
|
90
|
-
'scrollMarginRight',
|
|
91
|
-
'scrollMarginTop',
|
|
92
|
-
'scrollPaddingBlockEnd',
|
|
93
|
-
'scrollPaddingBlockStart',
|
|
94
|
-
'scrollPaddingInlineEnd',
|
|
95
|
-
'scrollPaddingInlineStart',
|
|
96
|
-
'scrollPaddingBottom',
|
|
97
|
-
'scrollPaddingLeft',
|
|
98
|
-
'scrollPaddingRight',
|
|
99
|
-
'scrollPaddingTop',
|
|
100
|
-
'shapeMargin',
|
|
101
|
-
'strokeDashoffset',
|
|
102
|
-
'strokeWidth',
|
|
103
|
-
'textDecorationThickness',
|
|
104
|
-
'textUnderlineOffset',
|
|
105
|
-
'verticalAlign',
|
|
106
|
-
'x',
|
|
107
|
-
'y',
|
|
108
|
-
'zoom',
|
|
109
|
-
];
|
|
110
|
-
|
|
111
|
-
const fitContentString = 'fit-content\\([^()]*\\)';
|
|
112
|
-
const minString = 'min\\([^()]*\\)';
|
|
113
|
-
const maxString = 'max\\([^()]*\\)';
|
|
114
|
-
const minmaxString = 'minmax\\([^()]*\\)';
|
|
115
|
-
|
|
116
|
-
const dashedIdentString = '--[a-zA-Z_][a-zA-Z0-9_-]*';
|
|
117
|
-
const varString = `var\\(${dashedIdentString}(,\\s*[^\\)]+)?\\)`;
|
|
118
|
-
const varRegex = new RegExp(`^(${varString})$`);
|
|
119
|
-
const pureNumber = `(-?\\d+(\\.\\d+)?)`;
|
|
120
|
-
const numberPattern = `(${pureNumber}|${varString})`;
|
|
121
|
-
const percentagePattern = `${pureNumber}%`;
|
|
122
|
-
const pureInteger = `(-?\\d+)`;
|
|
123
|
-
const integerPattern = `(${pureInteger}|${varString})`;
|
|
124
|
-
const lengthPattern = `0|${pureNumber}(?:${unitData.join('|')})`;
|
|
125
|
-
const pureAngle = `${pureNumber}(deg|rad|grad|turn)`;
|
|
126
|
-
const anglePattern = `(${pureAngle}|${varString})`;
|
|
127
|
-
|
|
128
|
-
const calcString = 'calc\\(.*?\\)';
|
|
129
|
-
const anchorString = 'anchor\\([^()]*\\)';
|
|
130
|
-
const anchorSizeString = 'anchor-size\\([^()]*\\)';
|
|
131
|
-
const clampString = 'clamp\\([^()]*\\)';
|
|
132
|
-
const gradientString =
|
|
133
|
-
'(?:repeating-)?(?:linear|radial|conic)-gradient\\(.*\\)';
|
|
134
|
-
const urlString = 'url\\([^\\)]+\\)';
|
|
135
|
-
const imageSetString = 'image-set\\([^\\)]+\\)';
|
|
136
|
-
const attrString = 'attr\\([^\\)]+\\)';
|
|
137
|
-
const addString = `add\\(${integerPattern}\\)`;
|
|
138
|
-
const counterString = 'counter\\([^\\)]+\\)';
|
|
139
|
-
const countersString = 'counters\\([^\\)]+\\)';
|
|
140
|
-
const doubleQuoteString = '"[^"]*"';
|
|
141
|
-
const singleQuoteString = "'[^']*'";
|
|
142
|
-
const stringString = `(?:${doubleQuoteString}|${singleQuoteString})`;
|
|
143
|
-
const repeatString = 'repeat\\([^\\)]+\\)';
|
|
144
|
-
const colorSpaces =
|
|
145
|
-
'srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|lab|oklab|xyz|xyz-d50|xyz-d65|hsl|hwb|lch|oklch';
|
|
146
|
-
const hueModifiers = '(?:\\s+(?:shorter|longer|increasing|decreasing)\\s+hue)?';
|
|
147
|
-
|
|
148
|
-
const colorSpacePattern = `in\\s+(?:${colorSpaces})${hueModifiers}`;
|
|
149
|
-
|
|
150
|
-
function buildPaletteMixPattern() {
|
|
151
|
-
const lastArgPattern = `(?:(${dashedIdentString}|${varString}))(?:\\s+(${percentagePattern}|${varString}))?`;
|
|
152
|
-
|
|
153
|
-
return `palette-mix\\(${colorSpacePattern},\\s*${lastArgPattern},\\s*${lastArgPattern}\\)`;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const paletteMixString = buildPaletteMixPattern();
|
|
157
|
-
|
|
158
|
-
function buildColorMixPattern() {
|
|
159
|
-
const lastArgPattern = `(${colorValue}|${varString})(?:\\s+(${percentagePattern}|${varString}))?`;
|
|
160
|
-
|
|
161
|
-
return `color-mix\\(${colorSpacePattern},\\s*${lastArgPattern},\\s*${lastArgPattern}\\)`;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const colorMixString = buildColorMixPattern();
|
|
165
|
-
const lightDarkValue = `${colorValue}|${colorMixString}|${varString}`;
|
|
166
|
-
const lightDarkString = `light-dark\\((?:${lightDarkValue}),\\s*(?:${lightDarkValue})\\)`;
|
|
167
|
-
|
|
168
|
-
const colorRegex = new RegExp(
|
|
169
|
-
`^(${colorValue}|${colorMixString}|${lightDarkString}|${varString})$`,
|
|
170
|
-
);
|
|
171
|
-
const colorSource = colorRegex.source.slice(1, -1);
|
|
172
|
-
|
|
173
|
-
const imageRegex = new RegExp(`^(${gradientString}|${urlString})$`);
|
|
174
|
-
const urlRegex = new RegExp(`^(${urlString})$`);
|
|
175
|
-
|
|
176
|
-
const sliceValuePattern =
|
|
177
|
-
'^(?:-?\\d+(?:\\.\\d+)?%?|fill)(?:\\s+(?:-?\\d+(?:\\.\\d+)?%?|fill)){0,3}$';
|
|
178
|
-
const sliceRegex = new RegExp(`^(${sliceValuePattern})$`);
|
|
179
|
-
|
|
180
|
-
const otherGroupProperties = [
|
|
181
|
-
'fontWeight',
|
|
182
|
-
'opacity',
|
|
183
|
-
'stopOpacity',
|
|
184
|
-
'strokeOpacity',
|
|
185
|
-
'flexGrow',
|
|
186
|
-
'flexShrink',
|
|
187
|
-
];
|
|
188
|
-
const integerGroupProperties = [
|
|
189
|
-
'columnCount',
|
|
190
|
-
'zIndex',
|
|
191
|
-
'order',
|
|
192
|
-
'orphans',
|
|
193
|
-
'widows',
|
|
194
|
-
];
|
|
195
|
-
|
|
196
|
-
const multipleValueProperties = [
|
|
197
|
-
'borderSpacing',
|
|
198
|
-
'borderEndEndRadius',
|
|
199
|
-
'borderEndStartRadius',
|
|
200
|
-
'borderStartEndRadius',
|
|
201
|
-
'borderStartStartRadius',
|
|
202
|
-
'borderTopLeftRadius',
|
|
203
|
-
'borderTopRightRadius',
|
|
204
|
-
'borderBottomLeftRadius',
|
|
205
|
-
'borderBottomRightRadius',
|
|
206
|
-
'borderBlockWidth',
|
|
207
|
-
'borderInlineWidth',
|
|
208
|
-
'gap',
|
|
209
|
-
'scale',
|
|
210
|
-
'inset',
|
|
211
|
-
'padding',
|
|
212
|
-
'margin',
|
|
213
|
-
'borderWidth',
|
|
214
|
-
'borderImageWidth',
|
|
215
|
-
'borderImageOutset',
|
|
216
|
-
];
|
|
217
|
-
|
|
218
|
-
const valueCountMap = {
|
|
219
|
-
inset: 4,
|
|
220
|
-
gap: 2,
|
|
221
|
-
padding: 4,
|
|
222
|
-
margin: 4,
|
|
223
|
-
borderSpacing: 2,
|
|
224
|
-
borderWidth: 4,
|
|
225
|
-
borderStartStartRadius: 2,
|
|
226
|
-
borderStartEndRadius: 2,
|
|
227
|
-
borderEndStartRadius: 2,
|
|
228
|
-
borderEndEndRadius: 2,
|
|
229
|
-
borderTopLeftRadius: 2,
|
|
230
|
-
borderTopRightRadius: 2,
|
|
231
|
-
borderBottomRightRadius: 2,
|
|
232
|
-
borderBottomLeftRadius: 2,
|
|
233
|
-
borderImageWidth: 4,
|
|
234
|
-
borderImageOutset: 4,
|
|
235
|
-
borderBlockWidth: 2,
|
|
236
|
-
borderInlineWidth: 2,
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const singleColorProperties = [
|
|
240
|
-
'accentColor',
|
|
241
|
-
'color',
|
|
242
|
-
'borderTopColor',
|
|
243
|
-
'borderBottomColor',
|
|
244
|
-
'borderLeftColor',
|
|
245
|
-
'borderRightColor',
|
|
246
|
-
'borderBlockColor',
|
|
247
|
-
'borderBlockStartColor',
|
|
248
|
-
'borderBlockEndColor',
|
|
249
|
-
'borderInlineColor',
|
|
250
|
-
'borderInlineStartColor',
|
|
251
|
-
'borderInlineEndColor',
|
|
252
|
-
'backgroundColor',
|
|
253
|
-
'outlineColor',
|
|
254
|
-
'textDecorationColor',
|
|
255
|
-
'caretColor',
|
|
256
|
-
'columnRuleColor',
|
|
257
|
-
'sropColor',
|
|
258
|
-
'textEmphasisColor',
|
|
259
|
-
];
|
|
260
|
-
const borderColorProperties = ['borderColor'];
|
|
261
|
-
const borderImageProperties = ['borderImage'];
|
|
262
|
-
|
|
263
|
-
const borderWidthProperties = [
|
|
264
|
-
'borderWidth',
|
|
265
|
-
'borderBlockWidth',
|
|
266
|
-
'borderInlineWidth',
|
|
267
|
-
'columnRuleWidth',
|
|
268
|
-
'outlineWidth',
|
|
269
|
-
];
|
|
270
|
-
const ImageSourceProperties = [
|
|
271
|
-
'borderImageSource',
|
|
272
|
-
'listStyleImage',
|
|
273
|
-
'maskBorderSource',
|
|
274
|
-
'maskImage',
|
|
275
|
-
];
|
|
276
|
-
const borderProperties = [
|
|
277
|
-
'border',
|
|
278
|
-
'outline', // same as border
|
|
279
|
-
'columnRule', // same as border
|
|
280
|
-
'borderTop',
|
|
281
|
-
'borderBottom',
|
|
282
|
-
'borderLeft',
|
|
283
|
-
'borderRight',
|
|
284
|
-
'borderBlock',
|
|
285
|
-
'borderBlockStart',
|
|
286
|
-
'borderBlockEnd',
|
|
287
|
-
'borderInline',
|
|
288
|
-
'borderInlineStart',
|
|
289
|
-
'borderInlineEnd',
|
|
290
|
-
];
|
|
291
|
-
|
|
292
|
-
const borderRadiusProperties = ['borderRadius'];
|
|
293
|
-
const borderStyleProperties = ['borderStyle'];
|
|
294
|
-
const borderImageSlice = ['borderImageSlice'];
|
|
295
|
-
|
|
296
|
-
const stylisticString = 'stylistic\\([^\\)]+\\)';
|
|
297
|
-
const stylesetString = 'styleset\\([^\\)]+\\)';
|
|
298
|
-
const characterVariantString = 'character-variant\\([^\\)]+\\)';
|
|
299
|
-
const swashString = 'swash\\([^\\)]+\\)';
|
|
300
|
-
const ornamentsString = 'ornaments\\([^\\)]+\\)';
|
|
301
|
-
const annotationString = 'annotation\\([^\\)]+\\)';
|
|
302
|
-
const notationFuncs = [
|
|
303
|
-
stylisticString,
|
|
304
|
-
stylesetString,
|
|
305
|
-
characterVariantString,
|
|
306
|
-
swashString,
|
|
307
|
-
ornamentsString,
|
|
308
|
-
annotationString,
|
|
309
|
-
varString,
|
|
310
|
-
].join('|');
|
|
311
|
-
|
|
312
|
-
function isValidMultipleColorValues(value) {
|
|
313
|
-
const colors = splitColorValues(value);
|
|
314
|
-
|
|
315
|
-
if (colors.length > 4) return false;
|
|
316
|
-
|
|
317
|
-
return colors.every(isValidColorValue);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
function isValidColorValue(value) {
|
|
321
|
-
return colorRegex.test(value);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function splitColorValues(value) {
|
|
325
|
-
const colors = [];
|
|
326
|
-
let remaining = value.trim();
|
|
327
|
-
let inParentheses = false;
|
|
328
|
-
let currentColor = '';
|
|
329
|
-
|
|
330
|
-
for (let i = 0; i < remaining.length; i++) {
|
|
331
|
-
const char = remaining[i];
|
|
332
|
-
|
|
333
|
-
if (char === '(') {
|
|
334
|
-
inParentheses = true;
|
|
335
|
-
} else if (char === ')') {
|
|
336
|
-
inParentheses = false;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (char === ' ' && !inParentheses && currentColor.length > 0) {
|
|
340
|
-
colors.push(currentColor.trim());
|
|
341
|
-
currentColor = '';
|
|
342
|
-
} else {
|
|
343
|
-
currentColor += char;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (currentColor.length > 0) {
|
|
348
|
-
colors.push(currentColor.trim());
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return colors;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
const lineWidth = ['thin', 'medium', 'thick'].join('|');
|
|
355
|
-
const lineStyle = [
|
|
356
|
-
'none',
|
|
357
|
-
'hidden',
|
|
358
|
-
'dotted',
|
|
359
|
-
'dashed',
|
|
360
|
-
'solid',
|
|
361
|
-
'double',
|
|
362
|
-
'groove',
|
|
363
|
-
'ridge',
|
|
364
|
-
'inset',
|
|
365
|
-
'outset',
|
|
366
|
-
varString,
|
|
367
|
-
].join('|');
|
|
368
|
-
|
|
369
|
-
const cursorValue = [
|
|
370
|
-
'auto',
|
|
371
|
-
'default',
|
|
372
|
-
'none',
|
|
373
|
-
'context-menu',
|
|
374
|
-
'help',
|
|
375
|
-
'pointer',
|
|
376
|
-
'progress',
|
|
377
|
-
'wait',
|
|
378
|
-
'cell',
|
|
379
|
-
'crosshair',
|
|
380
|
-
'text',
|
|
381
|
-
'vertical-text',
|
|
382
|
-
'alias',
|
|
383
|
-
'copy',
|
|
384
|
-
'move',
|
|
385
|
-
'no-drop',
|
|
386
|
-
'not-allowed',
|
|
387
|
-
'grab',
|
|
388
|
-
'grabbing',
|
|
389
|
-
'e-resize',
|
|
390
|
-
'n-resize',
|
|
391
|
-
'ne-resize',
|
|
392
|
-
'nw-resize',
|
|
393
|
-
's-resize',
|
|
394
|
-
'se-resize',
|
|
395
|
-
'sw-resize',
|
|
396
|
-
'w-resize',
|
|
397
|
-
'ew-resize',
|
|
398
|
-
'ns-resize',
|
|
399
|
-
'nesw-resize',
|
|
400
|
-
'nwse-resize',
|
|
401
|
-
'col-resize',
|
|
402
|
-
'row-resize',
|
|
403
|
-
'all-scroll',
|
|
404
|
-
'zoom-in',
|
|
405
|
-
'zoom-out',
|
|
406
|
-
varString,
|
|
407
|
-
].join('|');
|
|
408
|
-
|
|
409
|
-
/** @type {import('eslint').Rule.RuleModule} */
|
|
410
|
-
module.exports = {
|
|
411
|
-
meta: {
|
|
412
|
-
type: 'problem',
|
|
413
|
-
docs: {
|
|
414
|
-
description:
|
|
415
|
-
'Validate camelCase CSS property values in JS objects or JSX',
|
|
416
|
-
recommended: true,
|
|
417
|
-
},
|
|
418
|
-
schema: [],
|
|
419
|
-
messages: {
|
|
420
|
-
validateValue:
|
|
421
|
-
"'{{key}}' has an invalid value '{{value}}'. Valid values: {{validValues}}",
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
|
-
create(context) {
|
|
425
|
-
return {
|
|
426
|
-
ObjectExpression(node) {
|
|
427
|
-
node.properties.forEach((property) => {
|
|
428
|
-
if (
|
|
429
|
-
property.key &&
|
|
430
|
-
property.value &&
|
|
431
|
-
typeof property.key.name === 'string' &&
|
|
432
|
-
typeof property.value.value === 'string'
|
|
433
|
-
) {
|
|
434
|
-
const key = property.key.name;
|
|
435
|
-
const value = property.value.value;
|
|
436
|
-
|
|
437
|
-
if (validData[key]) {
|
|
438
|
-
const createReport = (property, key, value) => {
|
|
439
|
-
return () => {
|
|
440
|
-
context.report({
|
|
441
|
-
node: property.value,
|
|
442
|
-
messageId: 'validateValue',
|
|
443
|
-
data: {
|
|
444
|
-
key,
|
|
445
|
-
value,
|
|
446
|
-
validValues: validData[key].join(', '),
|
|
447
|
-
},
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
};
|
|
451
|
-
const report = createReport(property, key, value);
|
|
452
|
-
|
|
453
|
-
const globalValue =
|
|
454
|
-
!validData[key].includes(value) &&
|
|
455
|
-
!globalValues.includes(value) &&
|
|
456
|
-
!varRegex.test(value);
|
|
457
|
-
|
|
458
|
-
const isBorderWidth = borderWidthProperties.includes(key);
|
|
459
|
-
const multiAutoProperties = [
|
|
460
|
-
'borderImageWidth',
|
|
461
|
-
'margin',
|
|
462
|
-
'inset',
|
|
463
|
-
'backgroundSize',
|
|
464
|
-
'marginBlock', // auto
|
|
465
|
-
'marginInline', // auto
|
|
466
|
-
'scrollPaddingBlock', // auto
|
|
467
|
-
'scrollPaddingInline', // auto
|
|
468
|
-
];
|
|
469
|
-
const isAuto = multiAutoProperties.includes(key);
|
|
470
|
-
const numberAndLengthValues = [
|
|
471
|
-
'borderImageWidth',
|
|
472
|
-
'borderImageOutset',
|
|
473
|
-
'lineHeight',
|
|
474
|
-
'strokeDashoffset',
|
|
475
|
-
'strokeWidth',
|
|
476
|
-
'tabSize',
|
|
477
|
-
'zoom',
|
|
478
|
-
];
|
|
479
|
-
const isNumber = numberAndLengthValues.includes(key);
|
|
480
|
-
const isBackgroundSize = 'backgroundSize'.includes(key);
|
|
481
|
-
const isBackgroundPositionY = 'backgroundPositionY'.includes(key);
|
|
482
|
-
const isBackgroundPositionX = 'backgroundPositionY'.includes(key);
|
|
483
|
-
const isBackgroundPosition = 'backgroundPosition'.includes(key);
|
|
484
|
-
|
|
485
|
-
const integerValueRegex = RegExp(`^${integerPattern}$`);
|
|
486
|
-
const percentageValueRegex = RegExp(`^${percentagePattern}$`);
|
|
487
|
-
|
|
488
|
-
const lengthPercentage = [
|
|
489
|
-
'width',
|
|
490
|
-
'maxWidth',
|
|
491
|
-
'minWidth',
|
|
492
|
-
'height',
|
|
493
|
-
'maxHeight',
|
|
494
|
-
'minHeight',
|
|
495
|
-
'flexBasis',
|
|
496
|
-
'block-size',
|
|
497
|
-
'columnWidth',
|
|
498
|
-
'inline-size',
|
|
499
|
-
'fontSize',
|
|
500
|
-
'lineHeight',
|
|
501
|
-
'top',
|
|
502
|
-
'bottom',
|
|
503
|
-
'left',
|
|
504
|
-
'right',
|
|
505
|
-
'marginTop',
|
|
506
|
-
'marginBottom',
|
|
507
|
-
'marginLeft',
|
|
508
|
-
'marginRight',
|
|
509
|
-
'paddingTop',
|
|
510
|
-
'paddingBottom',
|
|
511
|
-
'paddingLeft',
|
|
512
|
-
'paddingRight',
|
|
513
|
-
'inset-block',
|
|
514
|
-
'maskBorderWidth',
|
|
515
|
-
'maskPosition',
|
|
516
|
-
'maskSize',
|
|
517
|
-
'maxBlockSize',
|
|
518
|
-
'minBlockSize',
|
|
519
|
-
'maxInlineSize',
|
|
520
|
-
'minInlineSize',
|
|
521
|
-
'offsetDistance',
|
|
522
|
-
'offset',
|
|
523
|
-
'paddingBlock',
|
|
524
|
-
'paddingBlockEnd',
|
|
525
|
-
'paddingBlockStart',
|
|
526
|
-
'paddingInline',
|
|
527
|
-
'paddingInlineEnd',
|
|
528
|
-
'paddingInlineStart',
|
|
529
|
-
'columnGap',
|
|
530
|
-
'rowGap',
|
|
531
|
-
'rx',
|
|
532
|
-
'ry',
|
|
533
|
-
'scrollPadding',
|
|
534
|
-
'scrollPaddingBlock',
|
|
535
|
-
'scrollPaddingBlockEnd',
|
|
536
|
-
'scrollPaddingBlockStart',
|
|
537
|
-
'scrollPaddingInline',
|
|
538
|
-
'scrollPaddingInlineEnd',
|
|
539
|
-
'scrollPaddingInlineStart',
|
|
540
|
-
'scrollPaddingBottom',
|
|
541
|
-
'scrollPaddingLeft',
|
|
542
|
-
'scrollPaddingRight',
|
|
543
|
-
'scrollPaddingTop',
|
|
544
|
-
'shapeMargin',
|
|
545
|
-
'x',
|
|
546
|
-
'y',
|
|
547
|
-
'zoom',
|
|
548
|
-
// multiple %
|
|
549
|
-
'gap',
|
|
550
|
-
'inset',
|
|
551
|
-
'padding',
|
|
552
|
-
'margin',
|
|
553
|
-
'borderRadius',
|
|
554
|
-
'borderEndEndRadius',
|
|
555
|
-
'borderEndStartRadius',
|
|
556
|
-
'borderStartEndRadius',
|
|
557
|
-
'borderStartStartRadius',
|
|
558
|
-
'borderTopLeftRadius',
|
|
559
|
-
'borderTopRightRadius',
|
|
560
|
-
'borderBottomLeftRadius',
|
|
561
|
-
'borderBottomRightRadius',
|
|
562
|
-
'backgroundPosition',
|
|
563
|
-
'backgroundPositionX',
|
|
564
|
-
'backgroundPositionY',
|
|
565
|
-
'background',
|
|
566
|
-
'backgroundSize',
|
|
567
|
-
'strokeDasharray',
|
|
568
|
-
'strokeDashoffset',
|
|
569
|
-
'strokeWidth',
|
|
570
|
-
'textDecorationThickness',
|
|
571
|
-
'textUnderlineOffset',
|
|
572
|
-
'transformOrigin',
|
|
573
|
-
'verticalAlign',
|
|
574
|
-
];
|
|
575
|
-
|
|
576
|
-
const isFitContentGroup = [
|
|
577
|
-
'width',
|
|
578
|
-
'maxWidth',
|
|
579
|
-
'minWidth',
|
|
580
|
-
'height',
|
|
581
|
-
'maxHeight',
|
|
582
|
-
'minHeight',
|
|
583
|
-
'blockSize',
|
|
584
|
-
'columnWidth',
|
|
585
|
-
'flexBasis',
|
|
586
|
-
'inlineSize',
|
|
587
|
-
];
|
|
588
|
-
|
|
589
|
-
const isLengthPercentage = lengthPercentage.includes(key);
|
|
590
|
-
const lengthValuePattern =
|
|
591
|
-
`${lengthPattern}` +
|
|
592
|
-
(isLengthPercentage ? `|${percentagePattern}` : '') +
|
|
593
|
-
(isFitContentGroup ? `|${fitContentString}` : '') +
|
|
594
|
-
(isNumber ? `|${numberPattern}` : '') +
|
|
595
|
-
(isAuto ? `|auto` : '') +
|
|
596
|
-
(isBorderWidth ? '|thin|medium|thick' : '') +
|
|
597
|
-
(isBackgroundPositionY ? '|top|center|bottom' : '') +
|
|
598
|
-
(isBackgroundPositionX ? '|left|center|right' : '') +
|
|
599
|
-
(isBackgroundPosition ? '|top|bottom|center|left|right' : '') +
|
|
600
|
-
(isBackgroundSize ? '|cover|contain' : '') +
|
|
601
|
-
`|${calcString}|${clampString}|${anchorString}|${anchorSizeString}|${minString}|${maxString}|${varString}`;
|
|
602
|
-
const lengthValueRegex = new RegExp(`^(${lengthValuePattern})$`);
|
|
603
|
-
|
|
604
|
-
const isOtherGroups = [
|
|
605
|
-
'opacity',
|
|
606
|
-
'stopOpacity',
|
|
607
|
-
'strokeOpacity',
|
|
608
|
-
].includes(key);
|
|
609
|
-
const otherSingleValue =
|
|
610
|
-
`${numberPattern}` + (isOtherGroups ? '%?' : '') + `|0`;
|
|
611
|
-
const otherSingleValueRegex = new RegExp(
|
|
612
|
-
`^(${otherSingleValue})$`,
|
|
613
|
-
);
|
|
614
|
-
|
|
615
|
-
const multipleValueRegex = new RegExp(
|
|
616
|
-
`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,${valueCountMap[key] - 1}}$`,
|
|
617
|
-
);
|
|
618
|
-
|
|
619
|
-
const backgroundPairRegex = new RegExp(
|
|
620
|
-
`^(${lengthValuePattern})(\\s+(${lengthValuePattern}))?(\\s*,\\s*(${lengthValuePattern})(\\s+(${lengthValuePattern}))?)*$`,
|
|
621
|
-
);
|
|
622
|
-
const backgroundPairProperties = [
|
|
623
|
-
'backgroundSize',
|
|
624
|
-
'backgroundPositionY',
|
|
625
|
-
'backgroundPositionX',
|
|
626
|
-
];
|
|
627
|
-
|
|
628
|
-
const backgroundQuadRegex = new RegExp(
|
|
629
|
-
`^(${lengthValuePattern})(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?(\\s*,\\s*(${lengthValuePattern})(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?(\\s+(${lengthValuePattern}))?)*$`,
|
|
630
|
-
);
|
|
631
|
-
|
|
632
|
-
const backgroundQuadProperties = ['backgroundPosition'];
|
|
633
|
-
|
|
634
|
-
const visualBox =
|
|
635
|
-
'border-box|padding-box|content-box|' + varString;
|
|
636
|
-
const backgroundOriginRegex = new RegExp(
|
|
637
|
-
`^(${visualBox})(\\s*,\\s*(${visualBox}))*$`,
|
|
638
|
-
);
|
|
639
|
-
const backgroundOriginProperties = [
|
|
640
|
-
'backgroundOrigin',
|
|
641
|
-
'backgroundClip',
|
|
642
|
-
];
|
|
643
|
-
|
|
644
|
-
const blendMode = [
|
|
645
|
-
'normal',
|
|
646
|
-
'multiply',
|
|
647
|
-
'screen',
|
|
648
|
-
'overlay',
|
|
649
|
-
'darken',
|
|
650
|
-
'lighten',
|
|
651
|
-
'color-dodge',
|
|
652
|
-
'color-burn',
|
|
653
|
-
'hard-light',
|
|
654
|
-
'soft-light',
|
|
655
|
-
'difference',
|
|
656
|
-
'exclusion',
|
|
657
|
-
'hue',
|
|
658
|
-
'saturation',
|
|
659
|
-
'color',
|
|
660
|
-
'luminosity',
|
|
661
|
-
varString,
|
|
662
|
-
].join('|');
|
|
663
|
-
|
|
664
|
-
const backgroundBlendModeRegex = new RegExp(
|
|
665
|
-
`^(${blendMode})(\\s*,\\s*(${blendMode}))*$`,
|
|
666
|
-
);
|
|
667
|
-
const backgroundBlendModeProperties = ['backgroundBlendMode'];
|
|
668
|
-
|
|
669
|
-
const attachment = `scroll|fixed|local|${varString}`;
|
|
670
|
-
const backgroundAttachmentProperties = ['backgroundAttachment'];
|
|
671
|
-
const backgroundAttachmentRegex = new RegExp(
|
|
672
|
-
`^(${attachment})(\\s*,\\s*(${attachment}))*$`,
|
|
673
|
-
);
|
|
674
|
-
|
|
675
|
-
const backgroundImageRegex = new RegExp(
|
|
676
|
-
`^(${gradientString}|${urlString}|${varString}|none)(\\s*,\\s*(${gradientString}|${urlString}|${varString}|none))*$`,
|
|
677
|
-
);
|
|
678
|
-
const backgroundImageProperties = ['backgroundImage'];
|
|
679
|
-
|
|
680
|
-
const repeatKeyword = 'repeat|space|round|no-repeat';
|
|
681
|
-
const backgroundRepeatRegex = new RegExp(
|
|
682
|
-
`^(((?:${repeatKeyword}|${varString})(\\s+(?:${repeatKeyword}|${varString})))?|(repeatX|repeatY))$`,
|
|
683
|
-
);
|
|
684
|
-
const backgroundRepeatProperties = ['backgroundRepeat'];
|
|
685
|
-
|
|
686
|
-
const backgroundRepeatSource = backgroundRepeatRegex.source.slice(
|
|
687
|
-
1,
|
|
688
|
-
-1,
|
|
689
|
-
);
|
|
690
|
-
|
|
691
|
-
const positionKeyword = `top|bottom|center|left|right|${varString}`;
|
|
692
|
-
const sizeKeyword = 'cover|contain';
|
|
693
|
-
|
|
694
|
-
const urlPattern = `(?:${urlString}|${gradientString}|${varString}\\s*)?`;
|
|
695
|
-
const positionPattern = `(?:${positionKeyword})(?:\\s+${positionKeyword})?`;
|
|
696
|
-
const singleValuePattern = `(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,2}?`;
|
|
697
|
-
const sizePattern = `(?:\\s*/\\s*(?:${sizeKeyword}|${singleValuePattern}))?`;
|
|
698
|
-
const repeatPattern = `(?:(?:${backgroundRepeatSource})\\s+)?`;
|
|
699
|
-
const attachmentPattern = `(?:${attachment}\\s+)?`;
|
|
700
|
-
const visualBoxPattern = `(?:${visualBox}\\s+)?`;
|
|
701
|
-
const colorValuePattern = `(?:\\s*${colorSource})?`;
|
|
702
|
-
|
|
703
|
-
const positionAndSizePattern = `(?:${positionPattern}${sizePattern})?`;
|
|
704
|
-
|
|
705
|
-
const flexibleLayerWithoutColor = [
|
|
706
|
-
positionAndSizePattern,
|
|
707
|
-
urlPattern,
|
|
708
|
-
repeatPattern,
|
|
709
|
-
attachmentPattern,
|
|
710
|
-
visualBoxPattern,
|
|
711
|
-
].join('|');
|
|
712
|
-
|
|
713
|
-
const flexibleLayerWithColor = `(?:${flexibleLayerWithoutColor}\\s*)*${colorValuePattern}`;
|
|
714
|
-
|
|
715
|
-
const backgroundRegex = new RegExp(
|
|
716
|
-
`^(?!\\s)(?=\\S)${flexibleLayerWithColor}(?:\\s*,\\s*${flexibleLayerWithColor})*$`,
|
|
717
|
-
);
|
|
718
|
-
|
|
719
|
-
const backgroundProperties = ['background'];
|
|
720
|
-
|
|
721
|
-
const boxShadowRegex = new RegExp(
|
|
722
|
-
`^(?:(?:inset\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${lengthValuePattern}))?\\s+(${colorSource}))(?:\\s*,\\s*(?:(?:inset\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${lengthValuePattern}))?\\s+(${colorSource})))*$`,
|
|
723
|
-
);
|
|
724
|
-
const boxShadowProperties = ['boxShadow'];
|
|
725
|
-
|
|
726
|
-
const borderRadiusRegex = new RegExp(
|
|
727
|
-
`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3}(\\s*/\\s*(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3})?$`,
|
|
728
|
-
);
|
|
729
|
-
|
|
730
|
-
const borderStyleRegex = new RegExp(
|
|
731
|
-
`^(${lineStyle})( (?!\\s)(${lineStyle})){0,3}$`,
|
|
732
|
-
);
|
|
733
|
-
|
|
734
|
-
function createBorderImageRegex() {
|
|
735
|
-
const varString = `var\\(${dashedIdentString}(,\\s*[^\\)]+)?\\)?`;
|
|
736
|
-
const valueOrVar = `(${varString}|${lengthValuePattern})`;
|
|
737
|
-
|
|
738
|
-
const imageSource = `${imageRegex.source.slice(1, -1)}|${varString}`; // Image source or var()
|
|
739
|
-
const slicePart = `(?:\\s+fill|${valueOrVar}(?:\\s+fill|${valueOrVar}){0,3})?`; // Optional slice part
|
|
740
|
-
const widthPart = `(?:\\s*\\/\\s*auto|${valueOrVar}(?:\\s+auto|${valueOrVar}){0,3})?`; // Optional width part
|
|
741
|
-
const outsetPart = `(?:\\s*\\/\\s*${valueOrVar}(?:\\s+${valueOrVar}){0,3})?`; // Optional outset part
|
|
742
|
-
const repeatPart = `(?:\\s+(${varString}|stretch|repeat|round|space)){0,2}?`; // Optional repeat part
|
|
743
|
-
|
|
744
|
-
return new RegExp(
|
|
745
|
-
`^${imageSource}` +
|
|
746
|
-
`${slicePart}` +
|
|
747
|
-
`${widthPart}` +
|
|
748
|
-
`${outsetPart}` +
|
|
749
|
-
`${repeatPart}$`,
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
const borderImageRegex = createBorderImageRegex();
|
|
753
|
-
|
|
754
|
-
const aspectRatioRegex = new RegExp(
|
|
755
|
-
`^(auto\\s+)?(${varString}|${numberPattern}(\\s*\\/\\s*${numberPattern})?|auto)(\\s+auto)?$`,
|
|
756
|
-
);
|
|
757
|
-
const aspectRatioProperties = ['aspectRatio'];
|
|
758
|
-
|
|
759
|
-
const timeUnit = '(s|ms)';
|
|
760
|
-
const animationTimeRegex = new RegExp(
|
|
761
|
-
`^-?(${pureNumber}${timeUnit}|${varString})(,\\s-?(${pureNumber}${timeUnit}|${varString}))*$`,
|
|
762
|
-
);
|
|
763
|
-
|
|
764
|
-
const animationTimeProperties = [
|
|
765
|
-
'animationDelay',
|
|
766
|
-
'animationDuration',
|
|
767
|
-
'transitionDelay',
|
|
768
|
-
'transitionDuration',
|
|
769
|
-
];
|
|
770
|
-
|
|
771
|
-
const animationDirection = [
|
|
772
|
-
'normal',
|
|
773
|
-
'reverse',
|
|
774
|
-
'alternate',
|
|
775
|
-
'alternate-reverse',
|
|
776
|
-
varString,
|
|
777
|
-
].join('|');
|
|
778
|
-
const animationDirectionRegex = new RegExp(
|
|
779
|
-
`^(${animationDirection})(,\\s*(${animationDirection}))*$`,
|
|
780
|
-
);
|
|
781
|
-
const animationDirectionProperties = ['animationDirection'];
|
|
782
|
-
|
|
783
|
-
const animationFillMode = [
|
|
784
|
-
'none',
|
|
785
|
-
'forwards',
|
|
786
|
-
'backwards',
|
|
787
|
-
'both',
|
|
788
|
-
varString,
|
|
789
|
-
].join('|');
|
|
790
|
-
const animationFillModeRegex = new RegExp(
|
|
791
|
-
`^(${animationFillMode})(,\\s*(${animationFillMode}))*$`,
|
|
792
|
-
);
|
|
793
|
-
const animationFillModeProperties = ['animationFillMode'];
|
|
794
|
-
|
|
795
|
-
const animationPlayState = ['paused', 'running', varString].join(
|
|
796
|
-
'|',
|
|
797
|
-
);
|
|
798
|
-
const animationPlayStateRegex = new RegExp(
|
|
799
|
-
`^(${animationPlayState})(,\\s*(${animationPlayState}))*$`,
|
|
800
|
-
);
|
|
801
|
-
const animationPlayStateProperties = ['animationPlayState'];
|
|
802
|
-
|
|
803
|
-
const animationIterationCountRegex = new RegExp(
|
|
804
|
-
`^${numberPattern}|infinite(,\\s*${numberPattern}|infinite)*$`,
|
|
805
|
-
);
|
|
806
|
-
const animationIterationCountProperties = [
|
|
807
|
-
'animationIterationCount',
|
|
808
|
-
];
|
|
809
|
-
|
|
810
|
-
const stringNameRegex = new RegExp('^.*$');
|
|
811
|
-
const stringNameProperties = [
|
|
812
|
-
'animationName',
|
|
813
|
-
'counterIncrement',
|
|
814
|
-
'counterReset',
|
|
815
|
-
'counterSet',
|
|
816
|
-
'font',
|
|
817
|
-
'fontFamily',
|
|
818
|
-
'gridArea',
|
|
819
|
-
'gridColumn',
|
|
820
|
-
'gridColumnEnd',
|
|
821
|
-
'gridColumnStart',
|
|
822
|
-
'gridRow',
|
|
823
|
-
'gridRowEnd',
|
|
824
|
-
'gridRowStart',
|
|
825
|
-
'listStyleType',
|
|
826
|
-
'listStyle',
|
|
827
|
-
'transitionProperty',
|
|
828
|
-
'transition',
|
|
829
|
-
'viewTransitionName',
|
|
830
|
-
'willChange',
|
|
831
|
-
];
|
|
832
|
-
|
|
833
|
-
const easing = [
|
|
834
|
-
'ease',
|
|
835
|
-
'ease-in',
|
|
836
|
-
'ease-out',
|
|
837
|
-
'ease-in-out',
|
|
838
|
-
'linear',
|
|
839
|
-
'step-start',
|
|
840
|
-
'step-end',
|
|
841
|
-
];
|
|
842
|
-
const easingPattern = easing.join('|');
|
|
843
|
-
|
|
844
|
-
const zeroToOne = '(0(\\.\\d+)?|1(\\.0+)?|0?\\.\\d+)';
|
|
845
|
-
|
|
846
|
-
const cubicBezierPattern = `cubic-bezier\\(\\s*${zeroToOne}\\s*,\\s*(-?\\d+(\\.\\d+)?)\\s*,\\s*${zeroToOne}\\s*,\\s*(-?\\d+(\\.\\d+)?)\\s*\\)`;
|
|
847
|
-
|
|
848
|
-
const numberPercentage = `${zeroToOne}(\\s+\\d+(\\.\\d+)?%){0,2}`; // number %? %?
|
|
849
|
-
|
|
850
|
-
const linearPattern = `linear\\(\\s*(${numberPercentage}(\\s*,\\s*${numberPercentage})*)+\\s*\\)`;
|
|
851
|
-
|
|
852
|
-
const stepPositions = [
|
|
853
|
-
'jump-start',
|
|
854
|
-
'jump-end',
|
|
855
|
-
'jump-none',
|
|
856
|
-
'jump-both',
|
|
857
|
-
'start',
|
|
858
|
-
'end',
|
|
859
|
-
];
|
|
860
|
-
const stepPositionPattern = stepPositions.join('|');
|
|
861
|
-
const stepPattern = `steps\\(\\s*(\\d+)\\s*,\\s*(${stepPositionPattern})\\s*\\)`;
|
|
862
|
-
|
|
863
|
-
const singleTimingFunctionPattern = `(${easingPattern}|${cubicBezierPattern}|${linearPattern}|${stepPattern}|${varString})`;
|
|
864
|
-
|
|
865
|
-
const animationTimingFunctionRegex = new RegExp(
|
|
866
|
-
`^${singleTimingFunctionPattern}(\\s*,\\s*${singleTimingFunctionPattern})*$`,
|
|
867
|
-
);
|
|
868
|
-
|
|
869
|
-
const animationTimingFunctionProperties = [
|
|
870
|
-
'animationTimingFunction',
|
|
871
|
-
'transitionTimingFunction',
|
|
872
|
-
];
|
|
873
|
-
|
|
874
|
-
const filterNumFunction = [
|
|
875
|
-
'brightness',
|
|
876
|
-
'contrast',
|
|
877
|
-
'grayscale',
|
|
878
|
-
'invert',
|
|
879
|
-
'opacity',
|
|
880
|
-
'sepia',
|
|
881
|
-
'saturate',
|
|
882
|
-
].join('|');
|
|
883
|
-
const filterNumFunctionPattern = `(${filterNumFunction})\\(\\s*${numberPattern}%?\\s*\\)`;
|
|
884
|
-
const blurFunctionPattern = `blur\\(\\s*(${lengthPattern}|${calcString}|${clampString}|${minString}|${maxString})\\s*\\)`;
|
|
885
|
-
const angleFunctionPattern = `hue-rotate\\(\\s*${anglePattern}\\s*\\)`;
|
|
886
|
-
const dropShadowPattern = `^drop-shadow\\(\\s*(?:${colorSource}|${lengthValuePattern})(?:\\s+(?:${colorSource}|${lengthValuePattern})){2,3}\\s*\\)$`;
|
|
887
|
-
const filterAllPattern = `${filterNumFunctionPattern}|${blurFunctionPattern}|${angleFunctionPattern}|${dropShadowPattern}|${urlPattern}`;
|
|
888
|
-
const filterPattern = `^(${filterAllPattern}\\s*)+$`;
|
|
889
|
-
const filterRegex = new RegExp(filterPattern);
|
|
890
|
-
|
|
891
|
-
function isBorderValue(value) {
|
|
892
|
-
const parts = splitColorValues(value);
|
|
893
|
-
if (parts.length > 3) return false;
|
|
894
|
-
|
|
895
|
-
let hasWidth = false;
|
|
896
|
-
let hasStyle = false;
|
|
897
|
-
let hasColor = false;
|
|
898
|
-
|
|
899
|
-
for (const part of parts) {
|
|
900
|
-
if (varRegex.test(part)) {
|
|
901
|
-
continue;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
if (lineWidth.includes(part) || lengthValueRegex.test(part)) {
|
|
905
|
-
if (hasWidth) return false;
|
|
906
|
-
hasWidth = true;
|
|
907
|
-
} else if (lineStyle.includes(part)) {
|
|
908
|
-
if (hasStyle) return false;
|
|
909
|
-
hasStyle = true;
|
|
910
|
-
} else if (isValidColorValue(part)) {
|
|
911
|
-
if (hasColor) return false;
|
|
912
|
-
hasColor = true;
|
|
913
|
-
} else {
|
|
914
|
-
return false;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
return (
|
|
919
|
-
hasStyle ||
|
|
920
|
-
hasWidth ||
|
|
921
|
-
hasColor ||
|
|
922
|
-
parts.some((part) => varRegex.test(part))
|
|
923
|
-
);
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
const matrixString = 'matrix\\([^\\)]+\\)';
|
|
927
|
-
const matrix3dString = 'matrix3d\\([^\\)]+\\)';
|
|
928
|
-
const perspectiveString = 'perspective\\([^\\)]+\\)';
|
|
929
|
-
const rotateString = 'rotate\\([^\\)]+\\)';
|
|
930
|
-
const rotate3dString = 'rotate3d\\([^\\)]+\\)';
|
|
931
|
-
const rotateXString = 'rotateX\\([^\\)]+\\)';
|
|
932
|
-
const rotateYString = 'rotateY\\([^\\)]+\\)';
|
|
933
|
-
const rotateZString = 'rotateZ\\([^\\)]+\\)';
|
|
934
|
-
const scaleString = 'scale\\([^\\)]+\\)';
|
|
935
|
-
const scale3dString = 'scale3d\\([^\\)]+\\)';
|
|
936
|
-
const scaleXString = 'scaleX\\([^\\)]+\\)';
|
|
937
|
-
const scaleYString = 'scaleY\\([^\\)]+\\)';
|
|
938
|
-
const scaleZString = 'scaleZ\\([^\\)]+\\)';
|
|
939
|
-
const skewString = 'skew\\([^\\)]+\\)';
|
|
940
|
-
const skewXString = 'skewX\\([^\\)]+\\)';
|
|
941
|
-
const skewYString = 'skewY\\([^\\)]+\\)';
|
|
942
|
-
const translateString = 'translate\\([^\\)]+\\)';
|
|
943
|
-
const translate3dString = 'translate3d\\([^\\)]+\\)';
|
|
944
|
-
const translateXString = 'translateX\\([^\\)]+\\)';
|
|
945
|
-
const translateYString = 'translateY\\([^\\)]+\\)';
|
|
946
|
-
const translateZString = 'translateZ\\([^\\)]+\\)';
|
|
947
|
-
|
|
948
|
-
const transformFunctions = [
|
|
949
|
-
matrixString,
|
|
950
|
-
matrix3dString,
|
|
951
|
-
perspectiveString,
|
|
952
|
-
rotateString,
|
|
953
|
-
rotate3dString,
|
|
954
|
-
rotateXString,
|
|
955
|
-
rotateYString,
|
|
956
|
-
rotateZString,
|
|
957
|
-
scaleString,
|
|
958
|
-
scale3dString,
|
|
959
|
-
scaleXString,
|
|
960
|
-
scaleYString,
|
|
961
|
-
scaleZString,
|
|
962
|
-
skewString,
|
|
963
|
-
skewXString,
|
|
964
|
-
skewYString,
|
|
965
|
-
translateString,
|
|
966
|
-
translate3dString,
|
|
967
|
-
translateXString,
|
|
968
|
-
translateYString,
|
|
969
|
-
translateZString,
|
|
970
|
-
].join('|');
|
|
971
|
-
|
|
972
|
-
const filterProperties = ['backdropFilter', 'filter'];
|
|
973
|
-
|
|
974
|
-
const geometryBaseSet =
|
|
975
|
-
'content-box|padding-box|border-box|fill-box|stroke-box|view-box';
|
|
976
|
-
const geometryBox = geometryBaseSet + '|margin-box';
|
|
977
|
-
|
|
978
|
-
const insetString = 'inset\\([^\\)]+\\)';
|
|
979
|
-
const circleString = 'circle\\([^\\)]+\\)';
|
|
980
|
-
const ellipseString = 'ellipse\\([^\\)]+\\)';
|
|
981
|
-
const polygonString = 'polygon\\([^\\)]+\\)';
|
|
982
|
-
const pathString = `path\\(${stringString}\\)`;
|
|
983
|
-
const rectString = 'rect\\([^\\)]+\\)';
|
|
984
|
-
const xywhString = 'xywh\\([^\\)]+\\)';
|
|
985
|
-
|
|
986
|
-
const basicShapeWithoutVar = `(${varString}|${insetString}|${circleString}|${ellipseString}|${polygonString}|${pathString}|${rectString}|${xywhString})`;
|
|
987
|
-
const basicShapeString = `(${varString}\\s+${varString}|${varString}|${basicShapeWithoutVar})`;
|
|
988
|
-
const geometryBoxWithVar = `(${geometryBox}|${varString})`;
|
|
989
|
-
|
|
990
|
-
const clipPathRegex = new RegExp(
|
|
991
|
-
`^(${basicShapeString}|${geometryBoxWithVar}|${geometryBoxWithVar}\\s+${basicShapeString}|${basicShapeString}\\s+${geometryBoxWithVar})$`,
|
|
992
|
-
);
|
|
993
|
-
|
|
994
|
-
const clipPathProperties = ['clipPath'];
|
|
995
|
-
|
|
996
|
-
const columnsRegex = new RegExp(
|
|
997
|
-
`^(?:auto\\s*(?:auto|${lengthValuePattern}|${numberPattern})?|${numberPattern}\\s*(?:auto|${lengthValuePattern}|${numberPattern})?|${lengthValuePattern}\\s*(?:auto|${lengthValuePattern}|${numberPattern})?)$`,
|
|
998
|
-
);
|
|
999
|
-
const columnsProperties = ['columns'];
|
|
1000
|
-
|
|
1001
|
-
const contentValueRegex = new RegExp(
|
|
1002
|
-
`^(${urlString}|${gradientString}|${imageSetString}|${attrString}|${counterString}|${countersString}|${stringString})$`,
|
|
1003
|
-
);
|
|
1004
|
-
|
|
1005
|
-
const contentProperty = ['content'];
|
|
1006
|
-
|
|
1007
|
-
function isValidCursor(value) {
|
|
1008
|
-
const urlWithHotspotRegex = `(${urlString}|${varString})(\\s+(${numberPattern})(\\s+(${numberPattern}))?)?`;
|
|
1009
|
-
const urlPart = `(${urlWithHotspotRegex})`;
|
|
1010
|
-
const standalonePattern = new RegExp(`^(${cursorValue})$`);
|
|
1011
|
-
const urlListPattern = new RegExp(
|
|
1012
|
-
`^${urlPart}(\\s*,\\s*${urlPart})*\\s*,\\s*(${cursorValue})$`,
|
|
1013
|
-
);
|
|
1014
|
-
|
|
1015
|
-
if (standalonePattern.test(value)) {
|
|
1016
|
-
return true;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
if (!urlListPattern.test(value)) {
|
|
1020
|
-
return false;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
const parts = value.split(/\s*,\s*/);
|
|
1024
|
-
|
|
1025
|
-
const lastPart = parts[parts.length - 1];
|
|
1026
|
-
const isFallbackCursor = standalonePattern.test(lastPart);
|
|
1027
|
-
|
|
1028
|
-
if (!isFallbackCursor) return false;
|
|
1029
|
-
|
|
1030
|
-
const urlParts = parts.slice(0, -1);
|
|
1031
|
-
|
|
1032
|
-
return urlParts.every((part) => {
|
|
1033
|
-
const urlRegex = new RegExp(`^${urlWithHotspotRegex}$`);
|
|
1034
|
-
return urlRegex.test(part);
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
const cursorProperty = ['cursor'];
|
|
1038
|
-
|
|
1039
|
-
function isValidFlexValue(value) {
|
|
1040
|
-
// Remove all whitespace
|
|
1041
|
-
const cleanValue = value.replace(/\s+/g, ' ').trim();
|
|
1042
|
-
|
|
1043
|
-
// If empty string, invalid
|
|
1044
|
-
if (!cleanValue) {
|
|
1045
|
-
return false;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
// Split the value by spaces and check maximum length
|
|
1049
|
-
const parts = cleanValue.split(' ');
|
|
1050
|
-
if (parts.length > 3) {
|
|
1051
|
-
return false;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
// Handle single value case
|
|
1055
|
-
if (parts.length === 1) {
|
|
1056
|
-
// Single value can be either a number or a length
|
|
1057
|
-
return (
|
|
1058
|
-
new RegExp(`^${numberPattern}$`).test(parts[0]) ||
|
|
1059
|
-
new RegExp(lengthValuePattern).test(parts[0])
|
|
1060
|
-
);
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
// Handle two values case
|
|
1064
|
-
if (parts.length === 2) {
|
|
1065
|
-
// First value must be a number
|
|
1066
|
-
if (!new RegExp(`^${numberPattern}$`).test(parts[0])) {
|
|
1067
|
-
return false;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
// Second value can be either a number or a length
|
|
1071
|
-
return (
|
|
1072
|
-
new RegExp(`^${numberPattern}$`).test(parts[1]) ||
|
|
1073
|
-
new RegExp(lengthValuePattern).test(parts[1])
|
|
1074
|
-
);
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
// Handle three values case
|
|
1078
|
-
if (parts.length === 3) {
|
|
1079
|
-
// First two values must be numbers
|
|
1080
|
-
if (
|
|
1081
|
-
!new RegExp(`^${numberPattern}$`).test(parts[0]) ||
|
|
1082
|
-
!new RegExp(`^${numberPattern}$`).test(parts[1])
|
|
1083
|
-
) {
|
|
1084
|
-
return false;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
// Third value must be a length
|
|
1088
|
-
return new RegExp(lengthValuePattern).test(parts[2]);
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
return false;
|
|
1092
|
-
}
|
|
1093
|
-
const flexProperty = ['flex'];
|
|
1094
|
-
const tagA_E = [
|
|
1095
|
-
'aalt',
|
|
1096
|
-
'abvf',
|
|
1097
|
-
'abvm',
|
|
1098
|
-
'abvs',
|
|
1099
|
-
'afrc',
|
|
1100
|
-
'akhn',
|
|
1101
|
-
'apkn',
|
|
1102
|
-
'blwf',
|
|
1103
|
-
'blwm',
|
|
1104
|
-
'blws',
|
|
1105
|
-
'calt',
|
|
1106
|
-
'case',
|
|
1107
|
-
'ccmp',
|
|
1108
|
-
'cfar',
|
|
1109
|
-
'chws',
|
|
1110
|
-
'cjct',
|
|
1111
|
-
'clig',
|
|
1112
|
-
'cpct',
|
|
1113
|
-
'cpsp',
|
|
1114
|
-
'cswh',
|
|
1115
|
-
'curs',
|
|
1116
|
-
'cv(0[1-9]|[1-9][0-9])',
|
|
1117
|
-
'c2pc',
|
|
1118
|
-
'c2sc',
|
|
1119
|
-
'dist',
|
|
1120
|
-
'dlig',
|
|
1121
|
-
'dnom',
|
|
1122
|
-
'dtls',
|
|
1123
|
-
'expt',
|
|
1124
|
-
]
|
|
1125
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1126
|
-
.join('|');
|
|
1127
|
-
|
|
1128
|
-
const tagF_J = [
|
|
1129
|
-
'falt',
|
|
1130
|
-
'fin2',
|
|
1131
|
-
'fin3',
|
|
1132
|
-
'fina',
|
|
1133
|
-
'flac',
|
|
1134
|
-
'frac',
|
|
1135
|
-
'fwid',
|
|
1136
|
-
'half',
|
|
1137
|
-
'haln',
|
|
1138
|
-
'hist',
|
|
1139
|
-
'hkna',
|
|
1140
|
-
'hlig',
|
|
1141
|
-
'hojo',
|
|
1142
|
-
'hwid',
|
|
1143
|
-
'init',
|
|
1144
|
-
'isol',
|
|
1145
|
-
'ital',
|
|
1146
|
-
'jalt',
|
|
1147
|
-
'jp78',
|
|
1148
|
-
'jp83',
|
|
1149
|
-
'jp90',
|
|
1150
|
-
'jp04',
|
|
1151
|
-
]
|
|
1152
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1153
|
-
.join('|');
|
|
1154
|
-
|
|
1155
|
-
const tagsK_O = [
|
|
1156
|
-
'kern',
|
|
1157
|
-
'lfbd',
|
|
1158
|
-
'liga',
|
|
1159
|
-
'ljmo',
|
|
1160
|
-
'lnum',
|
|
1161
|
-
'locl',
|
|
1162
|
-
'ltra',
|
|
1163
|
-
'ltrm',
|
|
1164
|
-
'mark',
|
|
1165
|
-
'med2',
|
|
1166
|
-
'medi',
|
|
1167
|
-
'mgrk',
|
|
1168
|
-
'mkmk',
|
|
1169
|
-
'mset',
|
|
1170
|
-
'nalt',
|
|
1171
|
-
'nlck',
|
|
1172
|
-
'nukt',
|
|
1173
|
-
'numr',
|
|
1174
|
-
'onum',
|
|
1175
|
-
'ordn',
|
|
1176
|
-
'ornm',
|
|
1177
|
-
]
|
|
1178
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1179
|
-
.join('|');
|
|
1180
|
-
|
|
1181
|
-
const tagsP_T = [
|
|
1182
|
-
'palt',
|
|
1183
|
-
'pcap',
|
|
1184
|
-
'pkna',
|
|
1185
|
-
'pnum',
|
|
1186
|
-
'pref',
|
|
1187
|
-
'pres',
|
|
1188
|
-
'pstf',
|
|
1189
|
-
'psts',
|
|
1190
|
-
'pwid',
|
|
1191
|
-
'qwid',
|
|
1192
|
-
'rand',
|
|
1193
|
-
'rclt',
|
|
1194
|
-
'rkrf',
|
|
1195
|
-
'rlig',
|
|
1196
|
-
'rphf',
|
|
1197
|
-
'rtbd',
|
|
1198
|
-
'rtla',
|
|
1199
|
-
'rtlm',
|
|
1200
|
-
'ruby',
|
|
1201
|
-
'rvrn',
|
|
1202
|
-
'salt',
|
|
1203
|
-
'sinf',
|
|
1204
|
-
'size',
|
|
1205
|
-
'smcp',
|
|
1206
|
-
'smpl',
|
|
1207
|
-
'ss(0[1-9]|1[0-9]|20)',
|
|
1208
|
-
'ssty',
|
|
1209
|
-
'stch',
|
|
1210
|
-
'subs',
|
|
1211
|
-
'sups',
|
|
1212
|
-
'swsh',
|
|
1213
|
-
'titl',
|
|
1214
|
-
'tjmo',
|
|
1215
|
-
'tnam',
|
|
1216
|
-
'tnum',
|
|
1217
|
-
'trad',
|
|
1218
|
-
'twid',
|
|
1219
|
-
]
|
|
1220
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1221
|
-
.join('|');
|
|
1222
|
-
|
|
1223
|
-
const tagsU_Z = [
|
|
1224
|
-
'unic',
|
|
1225
|
-
'valt',
|
|
1226
|
-
'vapk',
|
|
1227
|
-
'vatu',
|
|
1228
|
-
'vchw',
|
|
1229
|
-
'vert',
|
|
1230
|
-
'vhal',
|
|
1231
|
-
'vjmo',
|
|
1232
|
-
'vkna',
|
|
1233
|
-
'vkrn',
|
|
1234
|
-
'vpal',
|
|
1235
|
-
'vrt2',
|
|
1236
|
-
'vrtr',
|
|
1237
|
-
'zero',
|
|
1238
|
-
]
|
|
1239
|
-
.map((tag) => `'${tag}'|"${tag}"`)
|
|
1240
|
-
.join('|');
|
|
1241
|
-
|
|
1242
|
-
const featureTag = [
|
|
1243
|
-
tagA_E,
|
|
1244
|
-
tagF_J,
|
|
1245
|
-
tagsK_O,
|
|
1246
|
-
tagsP_T,
|
|
1247
|
-
tagsU_Z,
|
|
1248
|
-
].join('|');
|
|
1249
|
-
const singlePair = `(${featureTag}|${varString})(\\s+(-?\\d+|on|off|${varString}))?`;
|
|
1250
|
-
|
|
1251
|
-
const fontFeatureSettingsRegex = new RegExp(
|
|
1252
|
-
`^${singlePair}(\\s*,\\s*${singlePair})*$`,
|
|
1253
|
-
);
|
|
1254
|
-
const fontFeatureSettingsProperties = ['fontFeatureSettings'];
|
|
1255
|
-
|
|
1256
|
-
const stringValueRegex = RegExp(`^${stringString}$`);
|
|
1257
|
-
const stringStringProperties = [
|
|
1258
|
-
'fontLanguageOverride',
|
|
1259
|
-
'hyphenateCharacter',
|
|
1260
|
-
];
|
|
1261
|
-
|
|
1262
|
-
const fontPaletteRegex = new RegExp(
|
|
1263
|
-
`^(${dashedIdentString}|${paletteMixString})$`,
|
|
1264
|
-
);
|
|
1265
|
-
const fontPaletteProperties = 'fontPalette';
|
|
1266
|
-
|
|
1267
|
-
const fontMetric = `ex-height|cap-height|ch-width|ic-width|ic-height|${varString}`;
|
|
1268
|
-
|
|
1269
|
-
function isValidFontSizeAdjust(value) {
|
|
1270
|
-
const cleanValue = value.replace(/\s+/g, ' ').trim();
|
|
1271
|
-
if (!cleanValue) {
|
|
1272
|
-
return false;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
const parts = cleanValue.split(' ');
|
|
1276
|
-
if (parts.length > 2) {
|
|
1277
|
-
return false;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
if (parts.length === 1) {
|
|
1281
|
-
return new RegExp(`^(${numberPattern})$`).test(parts[0]);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
if (parts.length === 2) {
|
|
1285
|
-
const isValidFirstPart = new RegExp(`^(${fontMetric})$`).test(
|
|
1286
|
-
parts[0],
|
|
1287
|
-
);
|
|
1288
|
-
if (!isValidFirstPart) {
|
|
1289
|
-
return false;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
return new RegExp(`^(${numberPattern})$`).test(parts[1]);
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
return false;
|
|
1296
|
-
}
|
|
1297
|
-
const fontSizeAdjustProperties = ['fontSizeAdjust'];
|
|
1298
|
-
|
|
1299
|
-
const fontStretchProperties = ['fontStretch'];
|
|
1300
|
-
|
|
1301
|
-
const fontStyleRegex = new RegExp(
|
|
1302
|
-
`^(oblique|${anglePattern})(\\s+(oblique|${anglePattern}))?$`,
|
|
1303
|
-
);
|
|
1304
|
-
const fontStyleProperties = ['fontStyle'];
|
|
1305
|
-
|
|
1306
|
-
const fontSynthesisRegex = new RegExp(
|
|
1307
|
-
`^(?:(weight|style|small-caps|position|${varString})(?:\\s+(?!\\1)(weight|style|small-caps|position|${varString}))*)?$`,
|
|
1308
|
-
'i',
|
|
1309
|
-
);
|
|
1310
|
-
const fontSynthesisProperties = ['fontSynthesis'];
|
|
1311
|
-
|
|
1312
|
-
const fontVariantAlternatesRegex = new RegExp(
|
|
1313
|
-
`^(?:` +
|
|
1314
|
-
`(?:(?:${notationFuncs})(?:\\s+(?:${notationFuncs})){0,5})` +
|
|
1315
|
-
`|(?:` +
|
|
1316
|
-
`(?:(?:${notationFuncs})\\s+){0,6}(historical-forms|${varString})` +
|
|
1317
|
-
`(?:\\s+(?:${notationFuncs})){0,6})` +
|
|
1318
|
-
`)$`,
|
|
1319
|
-
'i',
|
|
1320
|
-
);
|
|
1321
|
-
|
|
1322
|
-
const fontVariantAlternatesProperties = ['fontVariantAlternates'];
|
|
1323
|
-
|
|
1324
|
-
const fontVariantEastAsianRegex = new RegExp(
|
|
1325
|
-
'^' +
|
|
1326
|
-
`(?:jis78|jis83|jis90|jis04|simplified|traditional|full-width|proportional-width|ruby|${varString})` +
|
|
1327
|
-
`(?:\\s+(?:jis78|jis83|jis90|jis04|simplified|traditional|full-width|proportional-width|ruby|${varString})){0,2}` +
|
|
1328
|
-
'$',
|
|
1329
|
-
'i',
|
|
1330
|
-
);
|
|
1331
|
-
|
|
1332
|
-
function isValidFontVariantEastAsian(value) {
|
|
1333
|
-
if (!fontVariantEastAsianRegex.test(value)) {
|
|
1334
|
-
return false;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
const values = value.toLowerCase().split(/\s+/);
|
|
1338
|
-
|
|
1339
|
-
const jisCount = values.filter((v) =>
|
|
1340
|
-
[
|
|
1341
|
-
'jis78',
|
|
1342
|
-
'jis83',
|
|
1343
|
-
'jis90',
|
|
1344
|
-
'jis04',
|
|
1345
|
-
'simplified',
|
|
1346
|
-
'traditional',
|
|
1347
|
-
].includes(v),
|
|
1348
|
-
).length;
|
|
1349
|
-
|
|
1350
|
-
const widthCount = values.filter((v) =>
|
|
1351
|
-
['full-width', 'proportional-width'].includes(v),
|
|
1352
|
-
).length;
|
|
1353
|
-
|
|
1354
|
-
const rubyCount = values.filter((v) => v === 'ruby').length;
|
|
1355
|
-
|
|
1356
|
-
return jisCount <= 1 && widthCount <= 1 && rubyCount <= 1;
|
|
1357
|
-
}
|
|
1358
|
-
const fontVariantEastAsianProperties = ['fontVariantEastAsian'];
|
|
1359
|
-
|
|
1360
|
-
const commonLig =
|
|
1361
|
-
'common-ligatures|no-common-ligatures' + `|${varString}`;
|
|
1362
|
-
const discretionaryLig =
|
|
1363
|
-
'discretionary-ligatures|no-discretionary-ligatures' +
|
|
1364
|
-
`|${varString}`;
|
|
1365
|
-
const historicalLig =
|
|
1366
|
-
'historical-ligatures|no-historical-ligatures' +
|
|
1367
|
-
`|${varString}`;
|
|
1368
|
-
const contextualAlt =
|
|
1369
|
-
'contextual|no-contextual' + `|${varString}`;
|
|
1370
|
-
const fontVariantLigaturesRegex = new RegExp(
|
|
1371
|
-
`^(?:(?:(${commonLig})|)(?: (${discretionaryLig})|)(?: (${historicalLig})|)(?: (${contextualAlt})|)){1,4}$`,
|
|
1372
|
-
);
|
|
1373
|
-
const fontVariantLigaturesProperties = ['fontVariantLigatures'];
|
|
1374
|
-
|
|
1375
|
-
const alternatesValues = `(?:${notationFuncs}|historical-forms)`;
|
|
1376
|
-
const numericFigureValues = 'lining-nums|oldstyle-nums';
|
|
1377
|
-
const numericSpacingValues = 'proportional-nums|tabular-nums';
|
|
1378
|
-
const numericFractionValues =
|
|
1379
|
-
'diagonal-fractions|stacked-fractions';
|
|
1380
|
-
const numericOtherValues = 'normal|ordinal|slashed-zero';
|
|
1381
|
-
const eastAsianVariantValues =
|
|
1382
|
-
'jis78|jis83|jis90|jis04|simplified|traditional';
|
|
1383
|
-
const eastAsianWidthValues = 'full-width|proportional-width';
|
|
1384
|
-
const eastAsianRuby = 'ruby';
|
|
1385
|
-
const capsValues =
|
|
1386
|
-
'small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps';
|
|
1387
|
-
const emojiValues = 'text|emoji|unicode';
|
|
1388
|
-
const positionValues = 'sub|super';
|
|
1389
|
-
|
|
1390
|
-
const figureSpacingFractionValues = [
|
|
1391
|
-
numericFigureValues,
|
|
1392
|
-
numericSpacingValues,
|
|
1393
|
-
numericFractionValues,
|
|
1394
|
-
numericOtherValues,
|
|
1395
|
-
varString,
|
|
1396
|
-
].join('|');
|
|
1397
|
-
|
|
1398
|
-
const fontVariantNumericRegex = new RegExp(
|
|
1399
|
-
`^(?:(${figureSpacingFractionValues})(?:\\s+(?!\\1)(${figureSpacingFractionValues}))*)?$`,
|
|
1400
|
-
'i',
|
|
1401
|
-
);
|
|
1402
|
-
const fontVariantNumericProperties = ['fontVariantNumeric'];
|
|
1403
|
-
|
|
1404
|
-
const fontVariantRegex = new RegExp(
|
|
1405
|
-
`^(?:normal|none|` +
|
|
1406
|
-
// Main pattern with optional groups
|
|
1407
|
-
`(?:` +
|
|
1408
|
-
// Ligatures group
|
|
1409
|
-
`(?:(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})` +
|
|
1410
|
-
`(?:\\s+(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})){0,3})|` +
|
|
1411
|
-
// Caps group
|
|
1412
|
-
`(?:${capsValues})|` +
|
|
1413
|
-
// Alternates group (including historical-forms)
|
|
1414
|
-
`(?:${alternatesValues}(?:\\s+${alternatesValues})*)|` +
|
|
1415
|
-
// Numeric group
|
|
1416
|
-
`(?:(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})` +
|
|
1417
|
-
`(?:\\s+(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})){0,3})|` +
|
|
1418
|
-
// East Asian group
|
|
1419
|
-
`(?:(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})` +
|
|
1420
|
-
`(?:\\s+(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})){0,2})|` +
|
|
1421
|
-
// Position group
|
|
1422
|
-
`(?:${positionValues})|` +
|
|
1423
|
-
// Emoji group
|
|
1424
|
-
`(?:${emojiValues})` +
|
|
1425
|
-
`)` +
|
|
1426
|
-
// Allow multiple groups in any order
|
|
1427
|
-
`(?:\\s+` +
|
|
1428
|
-
`(?:` +
|
|
1429
|
-
`(?:(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})` +
|
|
1430
|
-
`(?:\\s+(?:${commonLig}|${discretionaryLig}|${historicalLig}|${contextualAlt})){0,3})|` +
|
|
1431
|
-
`(?:${capsValues})|` +
|
|
1432
|
-
`(?:${alternatesValues}(?:\\s+${alternatesValues})*)|` +
|
|
1433
|
-
`(?:(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})` +
|
|
1434
|
-
`(?:\\s+(?:${numericFigureValues}|${numericSpacingValues}|${numericFractionValues}|${numericOtherValues})){0,3})|` +
|
|
1435
|
-
`(?:(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})` +
|
|
1436
|
-
`(?:\\s+(?:${eastAsianVariantValues}|${eastAsianWidthValues}|${eastAsianRuby})){0,2})|` +
|
|
1437
|
-
`(?:${positionValues})|` +
|
|
1438
|
-
`(?:${emojiValues})` +
|
|
1439
|
-
`)` +
|
|
1440
|
-
`)*` +
|
|
1441
|
-
`)$`,
|
|
1442
|
-
'i',
|
|
1443
|
-
);
|
|
1444
|
-
|
|
1445
|
-
const fontVariantProperties = ['fontVariant'];
|
|
1446
|
-
|
|
1447
|
-
const axisTagDouble = '"wght"|"wdth"|"slnt"|"ital"|"opsz"';
|
|
1448
|
-
const axisTagSingle = "'wght'|'wdth'|'slnt'|'ital'|'opsz'";
|
|
1449
|
-
const fontVariationSettingsRegex = new RegExp(
|
|
1450
|
-
`^(${axisTagDouble}|${axisTagSingle}|${varString})\\s+(${numberPattern})$`,
|
|
1451
|
-
);
|
|
1452
|
-
const fontVariationSettingsProperties = ['fontVariationSettings'];
|
|
1453
|
-
|
|
1454
|
-
const frPattern = `${numberPattern}fr`;
|
|
1455
|
-
|
|
1456
|
-
const inArrayPattern = '[a-zA-Z][a-zA-Z0-9-_]*';
|
|
1457
|
-
const lineNamesString = `\\[\\s*${inArrayPattern}(?:\\s+${inArrayPattern})*\\s*\\]`;
|
|
1458
|
-
const lineNamesPattern = `(${lineNamesString}|${varString})`;
|
|
1459
|
-
const trackSizeKeywords =
|
|
1460
|
-
'auto|min-content|max-content|subgrid|masonry|row|column|row dense|column dense';
|
|
1461
|
-
const autoFlowPattern = `(?:auto-flow(?:\\s+dense)?|${varString})?`;
|
|
1462
|
-
|
|
1463
|
-
const gridTrackListPattern = [
|
|
1464
|
-
trackSizeKeywords,
|
|
1465
|
-
lengthValuePattern,
|
|
1466
|
-
frPattern,
|
|
1467
|
-
percentagePattern,
|
|
1468
|
-
minmaxString,
|
|
1469
|
-
fitContentString,
|
|
1470
|
-
repeatString,
|
|
1471
|
-
varString,
|
|
1472
|
-
].join('|');
|
|
1473
|
-
|
|
1474
|
-
const gridAutoColumnsRegex = new RegExp(
|
|
1475
|
-
`^(?:${gridTrackListPattern})(?:\\s+(?:${gridTrackListPattern}))*$`,
|
|
1476
|
-
);
|
|
1477
|
-
|
|
1478
|
-
const gridAutoColumnsRowsProperties = [
|
|
1479
|
-
'gridAutoColumns',
|
|
1480
|
-
'gridAutoRows',
|
|
1481
|
-
];
|
|
1482
|
-
|
|
1483
|
-
const quoteRegex = new RegExp(`${stringString}`);
|
|
1484
|
-
const gridTemplateAreasProperties = ['gridTemplateAreas'];
|
|
1485
|
-
|
|
1486
|
-
const gridAreaRowPattern =
|
|
1487
|
-
`(?:${lineNamesPattern}\\s+)?` +
|
|
1488
|
-
`(?:${stringString}|${varString})?` +
|
|
1489
|
-
`(?:\\s+(?:${gridTrackListPattern}))?` +
|
|
1490
|
-
`(?:\\s+${lineNamesPattern})?`;
|
|
1491
|
-
|
|
1492
|
-
const explicitTrackPattern =
|
|
1493
|
-
`(?:${lineNamesPattern}(?:\\s+|\\s*))?` +
|
|
1494
|
-
`(?:${gridTrackListPattern})` +
|
|
1495
|
-
`(?:\\s+${lineNamesPattern})?`;
|
|
1496
|
-
|
|
1497
|
-
const gridRegex = new RegExp(
|
|
1498
|
-
'^(?:' +
|
|
1499
|
-
// Option 1: Areas with rows and optional columns
|
|
1500
|
-
`(?:${gridAreaRowPattern}|${autoFlowPattern}\\s*)+?` +
|
|
1501
|
-
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+)?|` +
|
|
1502
|
-
// Option 2: Rows and/or columns
|
|
1503
|
-
`(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+` +
|
|
1504
|
-
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+)?|` +
|
|
1505
|
-
// Option 3: Columns only (starting with a slash)
|
|
1506
|
-
`\\s*\\/\\s*(?:${explicitTrackPattern}|${autoFlowPattern}(?:\\s+${explicitTrackPattern}|${autoFlowPattern})*)+` +
|
|
1507
|
-
')$',
|
|
1508
|
-
);
|
|
1509
|
-
|
|
1510
|
-
const gridProperties = ['grid'];
|
|
1511
|
-
|
|
1512
|
-
const isTemplateColumns = 'gridTemplateColumns'.includes(key);
|
|
1513
|
-
const templateTrackListPattern = [
|
|
1514
|
-
trackSizeKeywords,
|
|
1515
|
-
lineNamesPattern,
|
|
1516
|
-
lengthValuePattern,
|
|
1517
|
-
frPattern,
|
|
1518
|
-
percentagePattern,
|
|
1519
|
-
minmaxString,
|
|
1520
|
-
varString,
|
|
1521
|
-
...(isTemplateColumns ? [fitContentString] : []),
|
|
1522
|
-
].join('|');
|
|
1523
|
-
const gridTemplateTrackListRegex = new RegExp(
|
|
1524
|
-
`^(?:${templateTrackListPattern})(?:\\s+(?:${templateTrackListPattern}))*$`,
|
|
1525
|
-
);
|
|
1526
|
-
const gridTemplateTrackListProperties = [
|
|
1527
|
-
'gridTemplateColumns',
|
|
1528
|
-
'gridTemplateRows',
|
|
1529
|
-
];
|
|
1530
|
-
|
|
1531
|
-
const isValidateGridTemplate = (value) => {
|
|
1532
|
-
if (typeof value !== 'string') return false;
|
|
1533
|
-
|
|
1534
|
-
const gridAreaRowPattern =
|
|
1535
|
-
`(?:${lineNamesPattern}\\s+)?` +
|
|
1536
|
-
`(?:${stringString}|${varString})` +
|
|
1537
|
-
`(?:\\s+(?:${templateTrackListPattern}))?` +
|
|
1538
|
-
`(?:\\s+${lineNamesPattern})?`;
|
|
1539
|
-
|
|
1540
|
-
const explicitTrackPattern =
|
|
1541
|
-
`(?:${lineNamesPattern}(?:\\s+|\\s*))?` +
|
|
1542
|
-
`(?:${templateTrackListPattern}|${repeatString})` +
|
|
1543
|
-
`(?:\\s+${lineNamesPattern})?`;
|
|
1544
|
-
|
|
1545
|
-
return new RegExp(
|
|
1546
|
-
'^(?:' +
|
|
1547
|
-
// Option 1: Areas with rows and optional columns
|
|
1548
|
-
`(?:${gridAreaRowPattern}\\s*)+?` +
|
|
1549
|
-
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+)?|` +
|
|
1550
|
-
// Option 2: Rows and/or columns
|
|
1551
|
-
`(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+` +
|
|
1552
|
-
`(?:\\s*\\/\\s*(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+)?|` +
|
|
1553
|
-
// Option 3: Columns only (starting with a slash)
|
|
1554
|
-
`\\s*\\/\\s*(?:${explicitTrackPattern}(?:\\s+${explicitTrackPattern})*)+` +
|
|
1555
|
-
')$',
|
|
1556
|
-
).test(value);
|
|
1557
|
-
};
|
|
1558
|
-
|
|
1559
|
-
const gridTemplateProperties = ['gridTemplate'];
|
|
1560
|
-
|
|
1561
|
-
const hyphenateLimitCharsRegex = new RegExp(
|
|
1562
|
-
`^(${numberPattern}|auto)( (?!\\s)(${numberPattern}|auto)){0,2}$`,
|
|
1563
|
-
);
|
|
1564
|
-
const hyphenateLimitCharsProperties = ['hyphenateLimitChars'];
|
|
1565
|
-
|
|
1566
|
-
const imageOrientationRegex = new RegExp(
|
|
1567
|
-
`^(${anglePattern})( (?!\\s)(flip|${varString})){0,1}$`,
|
|
1568
|
-
);
|
|
1569
|
-
const imageOrientationProperties = ['imageOrientation'];
|
|
1570
|
-
|
|
1571
|
-
const initialLetterRegex = new RegExp(
|
|
1572
|
-
`^(${numberPattern})( (?!\\s)(${integerPattern}|drop|raise)){0,1}$`,
|
|
1573
|
-
);
|
|
1574
|
-
const initialLetterProperties = ['initialLetter'];
|
|
1575
|
-
|
|
1576
|
-
const insetPairRegex = new RegExp(
|
|
1577
|
-
`^(${lengthValuePattern}|auto)(\\s+(${lengthValuePattern}))?$`,
|
|
1578
|
-
);
|
|
1579
|
-
const insetPairProperties = ['insetBlock', 'insetInline'];
|
|
1580
|
-
|
|
1581
|
-
const marginPairRegex = new RegExp(
|
|
1582
|
-
`^(${lengthValuePattern})(\\s+(${lengthValuePattern}))?$`,
|
|
1583
|
-
);
|
|
1584
|
-
const marginPairProperties = [
|
|
1585
|
-
'marginBlock', //
|
|
1586
|
-
'marginInline', //
|
|
1587
|
-
'scrollPaddingBlock', // auto
|
|
1588
|
-
'scrollPaddingInline', // auto
|
|
1589
|
-
'paddingBlock', // not auto
|
|
1590
|
-
'paddingInline', // not auto
|
|
1591
|
-
'scrollMarginBlock', // not auto
|
|
1592
|
-
'scrollMarginInline', // not auto
|
|
1593
|
-
];
|
|
1594
|
-
|
|
1595
|
-
const markerProperties = [
|
|
1596
|
-
'marker',
|
|
1597
|
-
'markerEnd',
|
|
1598
|
-
'markerMid',
|
|
1599
|
-
'markerStart',
|
|
1600
|
-
];
|
|
1601
|
-
|
|
1602
|
-
const maskBorderOutsetRegex = new RegExp(
|
|
1603
|
-
`^(${lengthValuePattern}|${numberPattern})( (?!\\s)(${lengthValuePattern}|${numberPattern})){0,3}$`,
|
|
1604
|
-
);
|
|
1605
|
-
const maskBorderOutsetProperties = ['maskBorderOutset'];
|
|
1606
|
-
|
|
1607
|
-
const maskBorderSliceRegex = new RegExp(
|
|
1608
|
-
`^(${percentagePattern}|${numberPattern}|fill)( (?!\\s)(${percentagePattern}|${numberPattern}|fill)){0,3}$`,
|
|
1609
|
-
);
|
|
1610
|
-
const maskBorderSliceProperties = ['maskBorderSlice'];
|
|
1611
|
-
const maskBorderWidthRegex = new RegExp(
|
|
1612
|
-
`^(${lengthValuePattern}|${numberPattern}|auto)( (?!\\s)(${lengthValuePattern}|${numberPattern}|auto)){0,3}$`,
|
|
1613
|
-
);
|
|
1614
|
-
const maskBorderWidthProperties = ['maskBorderWidth'];
|
|
1615
|
-
|
|
1616
|
-
const modeKeyword = `luminance|alpha|${varString}`;
|
|
1617
|
-
|
|
1618
|
-
const repeatFullSet = `(${repeatKeyword}|${backgroundRepeatRegex.source.slice(1, -1)})`;
|
|
1619
|
-
|
|
1620
|
-
const maskBorderOutsetSource = maskBorderOutsetRegex.source.slice(
|
|
1621
|
-
1,
|
|
1622
|
-
-1,
|
|
1623
|
-
);
|
|
1624
|
-
const maskBorderSliceSource = maskBorderSliceRegex.source.slice(
|
|
1625
|
-
1,
|
|
1626
|
-
-1,
|
|
1627
|
-
);
|
|
1628
|
-
const maskBorderWidthSource = maskBorderWidthRegex.source.slice(
|
|
1629
|
-
1,
|
|
1630
|
-
-1,
|
|
1631
|
-
);
|
|
1632
|
-
|
|
1633
|
-
const maskBorderRegex = new RegExp(
|
|
1634
|
-
`^(?:${gradientString}|${urlString})` +
|
|
1635
|
-
`(?:\\s+${maskBorderSliceSource})?` +
|
|
1636
|
-
`(?:\\s?/\\s?${maskBorderWidthSource})?` +
|
|
1637
|
-
`(?:\\s?/\\s?${maskBorderOutsetSource})?` +
|
|
1638
|
-
`(?:\\s+(?:${repeatFullSet}))?` +
|
|
1639
|
-
`(?:\\s+(?:${modeKeyword}))?$`,
|
|
1640
|
-
);
|
|
1641
|
-
const maskBorderProperties = ['maskBorder'];
|
|
1642
|
-
|
|
1643
|
-
const maskClipKeyword =
|
|
1644
|
-
geometryBaseSet +
|
|
1645
|
-
`|no-clip|border|padding|content|text|${varString}`;
|
|
1646
|
-
const maskClipRegex = new RegExp(
|
|
1647
|
-
`^(${maskClipKeyword})(,\\s*(${maskClipKeyword}))*$`,
|
|
1648
|
-
);
|
|
1649
|
-
const maskClipProperties = ['maskClip'];
|
|
1650
|
-
|
|
1651
|
-
const compositeKeyword = `add|subtract|intersect|exclude|${varString}`;
|
|
1652
|
-
const maskCompositeRegex = new RegExp(
|
|
1653
|
-
`^(${compositeKeyword})(,\\s*(${compositeKeyword}))*$`,
|
|
1654
|
-
);
|
|
1655
|
-
const maskCompositeProperties = ['maskComposite'];
|
|
1656
|
-
|
|
1657
|
-
const maskModeKeyword = `alpha|luminance|match-source|${varString}`;
|
|
1658
|
-
const maskModeRegex = new RegExp(
|
|
1659
|
-
`^(${maskModeKeyword})(,\\s*(${maskModeKeyword}))*$`,
|
|
1660
|
-
);
|
|
1661
|
-
const maksModeProperties = ['maskMode'];
|
|
1662
|
-
|
|
1663
|
-
const maskOriginKeyword =
|
|
1664
|
-
geometryBaseSet + `|content|padding|border|${varString}`;
|
|
1665
|
-
const maskOriginRegex = new RegExp(
|
|
1666
|
-
`^(${maskOriginKeyword})(,\\s*(${maskOriginKeyword}))*$`,
|
|
1667
|
-
);
|
|
1668
|
-
const maskOriginProperties = ['maskOrigin'];
|
|
1669
|
-
|
|
1670
|
-
const maskPositionRegex = new RegExp(
|
|
1671
|
-
`^(?:(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3})(?:,\\s*(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3})*$`,
|
|
1672
|
-
);
|
|
1673
|
-
const maskPositionProperties = ['maskPosition'];
|
|
1674
|
-
|
|
1675
|
-
const maskRepeatRegex = new RegExp(
|
|
1676
|
-
`^(${backgroundRepeatSource})(,\\s*(${backgroundRepeatSource}))*$`,
|
|
1677
|
-
);
|
|
1678
|
-
const maskRepeatProperties = ['maskRepeat'];
|
|
1679
|
-
|
|
1680
|
-
const maskRepeatKeyword = 'stretch|repeat|round|space';
|
|
1681
|
-
const maskBorderRepeatRegex = new RegExp(
|
|
1682
|
-
`^((?:${maskRepeatKeyword}|${varString})(?:\\s+(?:${maskRepeatKeyword}|${varString}))?)$`,
|
|
1683
|
-
);
|
|
1684
|
-
const maskBorderRepeatProperties = [
|
|
1685
|
-
'maskBorderRepeat',
|
|
1686
|
-
'borderImageRepeat',
|
|
1687
|
-
];
|
|
1688
|
-
|
|
1689
|
-
const maskSizeRegex = new RegExp(
|
|
1690
|
-
`^(${lengthValuePattern}|cover|contain|auto)(\\s+(${lengthValuePattern}|cover|contain|auto))?(,\\s*(${lengthValuePattern}|cover|contain|auto)(\\s+(${lengthValuePattern}|cover|contain|auto))?)*$`,
|
|
1691
|
-
);
|
|
1692
|
-
const maskSizeProperties = ['maskSize'];
|
|
1693
|
-
|
|
1694
|
-
const position = `${positionKeyword}|${lengthValuePattern}`;
|
|
1695
|
-
const bgSize = `${lengthValuePattern}|cover|contain|auto`;
|
|
1696
|
-
const positionPair = `(${position})( (?!\\s)(${position})){0,1}?`;
|
|
1697
|
-
const bgSizePair = `(${bgSize})( (?!\\s)(${bgSize})){0,1}?`;
|
|
1698
|
-
|
|
1699
|
-
const maskLayerRegex =
|
|
1700
|
-
`(?:${gradientString}|${urlString})` +
|
|
1701
|
-
`(?:\\s+${positionPair})?` +
|
|
1702
|
-
`(?:\\s?/\\s?${bgSizePair})?` +
|
|
1703
|
-
`(?:\\s+${backgroundRepeatSource})?` +
|
|
1704
|
-
`(?:\\s+${maskOriginKeyword})?` +
|
|
1705
|
-
`(?:\\s+${maskClipKeyword})?` +
|
|
1706
|
-
`(?:\\s+${compositeKeyword})?` +
|
|
1707
|
-
`(?:\\s+${maskModeKeyword})?`;
|
|
1708
|
-
const maskRegex = new RegExp(
|
|
1709
|
-
`^${maskLayerRegex}(?:,(?:\\s+${maskLayerRegex}))*$`,
|
|
1710
|
-
);
|
|
1711
|
-
const maskProperties = ['mask'];
|
|
1712
|
-
|
|
1713
|
-
const mathDepthRegex = new RegExp(
|
|
1714
|
-
`^(${addString}|${integerPattern})$`,
|
|
1715
|
-
);
|
|
1716
|
-
const mathDepthProperties = ['mathDepth'];
|
|
1717
|
-
|
|
1718
|
-
const lengthPositionRegex = new RegExp(
|
|
1719
|
-
`^(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3}$`,
|
|
1720
|
-
);
|
|
1721
|
-
|
|
1722
|
-
const lengthPositionProperties = [
|
|
1723
|
-
'objectPosition',
|
|
1724
|
-
'offsetAnchor',
|
|
1725
|
-
'offsetPosition',
|
|
1726
|
-
'perspectiveOrigin',
|
|
1727
|
-
];
|
|
1728
|
-
|
|
1729
|
-
const rayString = 'ray\\([^\\)]+\\)';
|
|
1730
|
-
const offsetPathRegex = new RegExp(
|
|
1731
|
-
`^(${rayString}|${urlString}|${basicShapeString}|${geometryBaseSet})$`,
|
|
1732
|
-
);
|
|
1733
|
-
const offsetPathProperties = ['offsetPath'];
|
|
1734
|
-
|
|
1735
|
-
const offsetRotateRegex = new RegExp(
|
|
1736
|
-
`^(${anglePattern}|auto|reverse)( (?!\\s)(${anglePattern})){0,1}$`,
|
|
1737
|
-
);
|
|
1738
|
-
const offsetRotateProperties = ['offsetRotate'];
|
|
1739
|
-
|
|
1740
|
-
const offsetPositionSource = lengthPositionRegex.source.slice(
|
|
1741
|
-
1,
|
|
1742
|
-
-1,
|
|
1743
|
-
);
|
|
1744
|
-
const offsetRotateSource = offsetRotateRegex.source.slice(1, -1);
|
|
1745
|
-
// distance at use lengthValuePattern
|
|
1746
|
-
const offsetPathSource = offsetPathRegex.source.slice(1, -1);
|
|
1747
|
-
|
|
1748
|
-
const offsetRegex = new RegExp(
|
|
1749
|
-
`^(?!\\s)(?=\\S)(${offsetPositionSource})?\\s*(${offsetPathSource}(\\s(${lengthValuePattern}(\\s+${offsetRotateSource})?|${offsetRotateSource}))?)?\\s*(\\/\\s*${offsetPositionSource})?(?<!\\s)$`,
|
|
1750
|
-
);
|
|
1751
|
-
const offsetProperties = ['offset'];
|
|
1752
|
-
|
|
1753
|
-
const oveflowKeyword = `visible|hidden|clip|scroll|auto|${varString}`;
|
|
1754
|
-
const oveflowRegex = new RegExp(
|
|
1755
|
-
`^(${oveflowKeyword})(\\s+(${oveflowKeyword}))?$`,
|
|
1756
|
-
);
|
|
1757
|
-
const oveflowProperties = ['overflow'];
|
|
1758
|
-
|
|
1759
|
-
const overflowClipMarginRegex = new RegExp(
|
|
1760
|
-
`^(?:${lengthValuePattern}$|${visualBox}$|${lengthValuePattern}\\s+${visualBox}$|${visualBox}\\s+${lengthValuePattern}$)`,
|
|
1761
|
-
);
|
|
1762
|
-
const overflowClipMarginProperties = ['overflowClipMargin'];
|
|
1763
|
-
|
|
1764
|
-
const overscrollBehaviorRegex = new RegExp(
|
|
1765
|
-
`^(auto|contain|${varString})( (?!\\s)(auto|contain|${varString})){0,1}$`,
|
|
1766
|
-
);
|
|
1767
|
-
const overscrollBehaviorProperties = ['overscrollBehavior'];
|
|
1768
|
-
|
|
1769
|
-
const fill = `(fill|${varString})`;
|
|
1770
|
-
const stroke = `(stroke|${varString})`;
|
|
1771
|
-
const markers = `(markers|${varString})`;
|
|
1772
|
-
|
|
1773
|
-
const paintOrderPattern =
|
|
1774
|
-
`(?:(${fill})(\\s+(${stroke}))?(\\s+(${markers}))?)?` +
|
|
1775
|
-
`(?:(${fill})(\\s+(${markers}))?(\\s+(${stroke}))?)?` +
|
|
1776
|
-
`(?:(${stroke})(\\s+(${fill}))?(\\s+(${markers}))?)?` +
|
|
1777
|
-
`(?:(${stroke})(\\s+(${markers}))?(\\s+(${fill}))?)?` +
|
|
1778
|
-
`(?:(${markers})(\\s+(${fill}))?(\\s+(${stroke}))?)?` +
|
|
1779
|
-
`(?:(${markers})(\\s+(${stroke}))?(\\s+(${fill}))?)?`;
|
|
1780
|
-
const paintOrderRegex = new RegExp(`^(${paintOrderPattern})$`);
|
|
1781
|
-
const paintOrderProperties = ['paintOrder'];
|
|
1782
|
-
|
|
1783
|
-
const quotesRegex = new RegExp(
|
|
1784
|
-
`^(${stringString}|${varString})(\\s(${stringString}|${varString}))*$`,
|
|
1785
|
-
);
|
|
1786
|
-
const quotesProperties = ['quotes'];
|
|
1787
|
-
|
|
1788
|
-
const rotatePattern =
|
|
1789
|
-
`(?:(x|y|z|${varString})\\s+${anglePattern})?` +
|
|
1790
|
-
`(?:${numberPattern}\\s+${numberPattern}\\s+${numberPattern}\\s+${anglePattern})?` +
|
|
1791
|
-
`(?:${anglePattern})?`;
|
|
1792
|
-
const rotateRegex = new RegExp(`^(${rotatePattern})$`);
|
|
1793
|
-
const rotateProperties = ['rotate'];
|
|
1794
|
-
|
|
1795
|
-
const numberAndPercentagePattern = `${numberPattern}|${percentagePattern}`;
|
|
1796
|
-
const scaleRegex = new RegExp(
|
|
1797
|
-
`^(${numberAndPercentagePattern})( (?!\\s)(${numberAndPercentagePattern})){0,2}$`,
|
|
1798
|
-
);
|
|
1799
|
-
const scaleProperties = ['scale'];
|
|
1800
|
-
|
|
1801
|
-
const scrollMarginRegex = new RegExp(
|
|
1802
|
-
`^(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,3}$`,
|
|
1803
|
-
);
|
|
1804
|
-
const scrollMarginProperties = ['scrollMargin'];
|
|
1805
|
-
|
|
1806
|
-
const scrollPaddingRegex = new RegExp(
|
|
1807
|
-
`^(${lengthValuePattern}|auto)( (?!\\s)(${lengthValuePattern}|auto)){0,3}$`,
|
|
1808
|
-
);
|
|
1809
|
-
const scrollPaddingProperties = ['scrollPadding'];
|
|
1810
|
-
|
|
1811
|
-
const scrollbarColorRegex = new RegExp(
|
|
1812
|
-
`^(${colorSource}(\\s${colorSource})?)$`,
|
|
1813
|
-
);
|
|
1814
|
-
const scrollbarColorProperties = ['scrollbarColor'];
|
|
1815
|
-
|
|
1816
|
-
const shapeImageThresholdRegex = new RegExp(
|
|
1817
|
-
`^(${numberAndPercentagePattern})$`,
|
|
1818
|
-
);
|
|
1819
|
-
const shapeImageThresholdProperties = ['shapeImageThreshold'];
|
|
1820
|
-
|
|
1821
|
-
const outsideShape = `(${insetString}|${circleString}|${ellipseString}|${polygonString}|${varString})`;
|
|
1822
|
-
|
|
1823
|
-
const shapeVisualBox = 'margin-box|' + visualBox;
|
|
1824
|
-
const shapeOutsideRegex = new RegExp(
|
|
1825
|
-
`^(?:` +
|
|
1826
|
-
`(?:${outsideShape}(?:\\s+${shapeVisualBox})?)|` +
|
|
1827
|
-
`(?:${shapeVisualBox}(?:\\s+${outsideShape})?)|` +
|
|
1828
|
-
`${gradientString}|${urlString}|${varString}` +
|
|
1829
|
-
`)$`,
|
|
1830
|
-
);
|
|
1831
|
-
const shapeOutsideProperties = ['shapeOutside'];
|
|
1832
|
-
|
|
1833
|
-
const strokeRegex = new RegExp(
|
|
1834
|
-
`^${gradientString}|${urlString}|${colorSource}$`,
|
|
1835
|
-
);
|
|
1836
|
-
const strokeProperties = ['stroke'];
|
|
1837
|
-
|
|
1838
|
-
const strokeDasharrayRegex = new RegExp(
|
|
1839
|
-
`^(${numberPattern}|${lengthValuePattern})(,\\s(${numberPattern}|${lengthValuePattern}))*$`,
|
|
1840
|
-
);
|
|
1841
|
-
const strokeDasharrayProperties = ['strokeDasharray'];
|
|
1842
|
-
|
|
1843
|
-
const strokeMiterlimitRegex = new RegExp(`^(${numberPattern})$`);
|
|
1844
|
-
const strokeMiterlimitProperties = ['strokeMiterlimit'];
|
|
1845
|
-
|
|
1846
|
-
const isValidTextDecorationLine = (value) => {
|
|
1847
|
-
const decorationValues = [
|
|
1848
|
-
'underline',
|
|
1849
|
-
'overline',
|
|
1850
|
-
'line-through',
|
|
1851
|
-
'blink',
|
|
1852
|
-
];
|
|
1853
|
-
const usedValues = new Set();
|
|
1854
|
-
|
|
1855
|
-
const trimmedValue = value.trim();
|
|
1856
|
-
if (value !== trimmedValue) {
|
|
1857
|
-
return false;
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
const tokens = value.trim().split(/\s+/);
|
|
1861
|
-
|
|
1862
|
-
return tokens.every((token) => {
|
|
1863
|
-
if (token.startsWith('var(') && varRegex.test(token)) {
|
|
1864
|
-
return true;
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
if (
|
|
1868
|
-
decorationValues.includes(token) ||
|
|
1869
|
-
varString.includes(token)
|
|
1870
|
-
) {
|
|
1871
|
-
return !usedValues.has(token) && usedValues.add(token);
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
return false;
|
|
1875
|
-
});
|
|
1876
|
-
};
|
|
1877
|
-
const textDecorationProperties = ['textDecorationLine'];
|
|
1878
|
-
|
|
1879
|
-
const textIndentRegex = new RegExp(
|
|
1880
|
-
`^(${lengthValuePattern})(\\s(hanging|${varString})?)?(\\s(each-line|${varString})?)?$`,
|
|
1881
|
-
);
|
|
1882
|
-
const textIndentProperties = ['textIndent'];
|
|
1883
|
-
|
|
1884
|
-
const textShadowRegex = new RegExp(
|
|
1885
|
-
`^(?:(?:(${colorSource})\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${colorSource}))?(?:\\s*,\\s*(?:(${colorSource})\\s+)?(${lengthValuePattern})\\s+(${lengthValuePattern})(?:\\s+(${lengthValuePattern}))?(?:\\s+(${colorSource}))?)*|none)$`,
|
|
1886
|
-
);
|
|
1887
|
-
const textShadowProperties = ['textShadow'];
|
|
1888
|
-
|
|
1889
|
-
const alignKeyword = `start|end|center|flex-start|flex-end|${varString}`;
|
|
1890
|
-
const firstLast = `first|last|${varString}`;
|
|
1891
|
-
const baseline = `baseline|${varString}`;
|
|
1892
|
-
const touchActionProperties = ['touchAction'];
|
|
1893
|
-
const alignContentRegex = new RegExp(
|
|
1894
|
-
`^(((safe|unsafe|${varString})\\s+(${alignKeyword}))|(${firstLast})\\s+(${baseline}))$`,
|
|
1895
|
-
);
|
|
1896
|
-
const alignContentProperties = ['alignContent'];
|
|
1897
|
-
|
|
1898
|
-
const itemsSelfKeyword = `self-start|self-end|anchor-center|start|end|center|flex-start|flex-end|${varString}`;
|
|
1899
|
-
const alignItemsSelfRegex = new RegExp(
|
|
1900
|
-
`^(((safe|unsafe|${varString})\\s+(${itemsSelfKeyword}))|(${firstLast})\\s+(${baseline}))$`,
|
|
1901
|
-
);
|
|
1902
|
-
const alignItemsSelfProperties = ['alignItems', 'alignSelf'];
|
|
1903
|
-
|
|
1904
|
-
const leftGroup = `block|inline|${varString}`;
|
|
1905
|
-
const rightGroup = `flex|flow|flow-root|table|grid|ruby|math|run-in|${varString}`;
|
|
1906
|
-
const listItem = `list-item|${varString}`;
|
|
1907
|
-
const listItemRightGroup = `block|inline|flow|flow-root|run-in|${varString}`;
|
|
1908
|
-
const displayRegex = new RegExp(
|
|
1909
|
-
`^(((${leftGroup})\\s+(${rightGroup}))|(${listItem})\\s+(${listItemRightGroup}))$`,
|
|
1910
|
-
);
|
|
1911
|
-
const displayProperties = ['display'];
|
|
1912
|
-
|
|
1913
|
-
const direction = 'row|row-reverse|column|column-reverse';
|
|
1914
|
-
const wrap = 'nowrap|wrap|wrap-reverse';
|
|
1915
|
-
const flexFlowRegex = new RegExp(
|
|
1916
|
-
`^((${direction}|${varString})(\\s+(${wrap}|${varString})))$`,
|
|
1917
|
-
);
|
|
1918
|
-
const flexFlowProperties = ['flexFlow'];
|
|
1919
|
-
|
|
1920
|
-
const first = `(first|${varString})`;
|
|
1921
|
-
const last = `(last|${varString})`;
|
|
1922
|
-
const forceAllow = `(force-end|allow-end|${varString})`;
|
|
1923
|
-
|
|
1924
|
-
const hangingPunctuationPattern =
|
|
1925
|
-
`(?:${first}(?:\\s+${forceAllow})?)?` +
|
|
1926
|
-
`(?:${last}(?:\\s+${forceAllow})?)?` +
|
|
1927
|
-
`(?:${first}\\s+${forceAllow}\\s+${last})?` +
|
|
1928
|
-
`(?:${first}\\s+${last})?`;
|
|
1929
|
-
|
|
1930
|
-
const hangingPunctuationRegex = new RegExp(
|
|
1931
|
-
`^(${hangingPunctuationPattern})$`,
|
|
1932
|
-
);
|
|
1933
|
-
const hangingPunctuationProperties = ['hangingPunctuation'];
|
|
1934
|
-
|
|
1935
|
-
const justifyContentKeyword = `left|right|stretch|start|end|center|flex-start|flex-end|${varString}`;
|
|
1936
|
-
const justifyContentRegex = new RegExp(
|
|
1937
|
-
`^(((safe|unsafe|${varString})\\s+(${justifyContentKeyword}))|(${firstLast})\\s+(${baseline}))$`,
|
|
1938
|
-
);
|
|
1939
|
-
const justifyContentProperties = ['justifyContent'];
|
|
1940
|
-
|
|
1941
|
-
const justifyItemsSelfKeyword = `left|right|anchor-center|stretch|self-start|self-end|start|end|center|flex-start|flex-end|${varString}`;
|
|
1942
|
-
const justifySelfRegex = new RegExp(
|
|
1943
|
-
`^(((safe|unsafe|${varString})\\s+(${justifyItemsSelfKeyword}))|(${firstLast})\\s+(${baseline}))$`,
|
|
1944
|
-
);
|
|
1945
|
-
const justifySelfProperties = ['justifySelf'];
|
|
1946
|
-
|
|
1947
|
-
const legacyValues = `(legacy|${varString})\\s+(left|right|center|${varString})`;
|
|
1948
|
-
const justifyItemsRegex = new RegExp(
|
|
1949
|
-
`^(((safe|unsafe|${varString})\\s+(${justifyItemsSelfKeyword}))|(${firstLast})\\s+(${baseline})|(${legacyValues}))$`,
|
|
1950
|
-
);
|
|
1951
|
-
const justifyItemsProperties = ['justifyItems'];
|
|
1952
|
-
|
|
1953
|
-
const scrollSnapAlignKeyword = 'start|end|center';
|
|
1954
|
-
const scrollSnapAlignRegex = new RegExp(
|
|
1955
|
-
`^((?:${scrollSnapAlignKeyword}|${varString})(?:\\s+(?:${scrollSnapAlignKeyword}|${varString}))?)$`,
|
|
1956
|
-
);
|
|
1957
|
-
const scrollSnapAlignProperties = ['scrollSnapAlign'];
|
|
1958
|
-
|
|
1959
|
-
const scrollSnapTypeKeyword = 'x|y|block|inline|both';
|
|
1960
|
-
const snapStrictKeyowrd = 'mandatory|proximity';
|
|
1961
|
-
const scrollSnapTypeRegex = new RegExp(
|
|
1962
|
-
`^((?:${scrollSnapTypeKeyword}|${varString})(?:\\s+(?:${snapStrictKeyowrd}|${varString}))?)$`,
|
|
1963
|
-
);
|
|
1964
|
-
const scrollSnapTypeProperties = ['scrollSnapType'];
|
|
1965
|
-
|
|
1966
|
-
const leftRight = `left|right|${varString}`;
|
|
1967
|
-
const overUnder = `over|under|${varString}`;
|
|
1968
|
-
|
|
1969
|
-
const textEmphasisPositionRegex = new RegExp(
|
|
1970
|
-
`^(((?:${overUnder})(?:\\s+(?:${leftRight}))|(?:${leftRight})(?:\\s+(?:${overUnder})))?)$`,
|
|
1971
|
-
);
|
|
1972
|
-
const textEmphasisPositionProperties = ['textEmphasisPosition'];
|
|
1973
|
-
|
|
1974
|
-
const filledOpen = `filled|open|${varString}`;
|
|
1975
|
-
const emphasisStyleKeyword = `dot|circle|double-circle|triangle|sesame|${varString}`;
|
|
1976
|
-
const textEmphasisStyleRegex = new RegExp(
|
|
1977
|
-
`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword})))?|${stringString}?)$`,
|
|
1978
|
-
);
|
|
1979
|
-
const textEmphasisStyleProperties = ['textEmphasisStyle'];
|
|
1980
|
-
|
|
1981
|
-
const textEmphasisStyleSource =
|
|
1982
|
-
textEmphasisStyleRegex.source.slice(1, -1);
|
|
1983
|
-
const textEmphasisRegex = new RegExp(
|
|
1984
|
-
`^(${textEmphasisStyleSource})(\\s(${colorSource}))?$`,
|
|
1985
|
-
);
|
|
1986
|
-
const textEmphasisProperties = ['textEmphasis'];
|
|
1987
|
-
|
|
1988
|
-
const transformValue = `(${lengthValuePattern}|left|center|right|top|bottom)`;
|
|
1989
|
-
const transformOriginRegex = new RegExp(
|
|
1990
|
-
`^(${transformValue})(\\s(${transformValue}))?(\\s(${transformValue}))?$`,
|
|
1991
|
-
);
|
|
1992
|
-
const transformOriginProperties = ['transformOrigin'];
|
|
1993
|
-
|
|
1994
|
-
const transformRegex = new RegExp(
|
|
1995
|
-
`^((${transformFunctions})(\\s+(${transformFunctions}))*)?$`,
|
|
1996
|
-
);
|
|
1997
|
-
const transformProperties = ['transform'];
|
|
1998
|
-
|
|
1999
|
-
const translateRegex = new RegExp(
|
|
2000
|
-
`^(${lengthValuePattern}|${percentagePattern})(\\s(${lengthValuePattern}|${percentagePattern}))?(\\s(${lengthValuePattern}))?$`,
|
|
2001
|
-
);
|
|
2002
|
-
const translateProperties = ['translate'];
|
|
2003
|
-
|
|
2004
|
-
const placeContentProperties = ['placeContent'];
|
|
2005
|
-
const placeItemsProperties = ['placeItems'];
|
|
2006
|
-
const placeSelfProperties = ['placeSelf'];
|
|
2007
|
-
|
|
2008
|
-
if (translateProperties.includes(key)) {
|
|
2009
|
-
if (!translateRegex.test(value) && globalValue) {
|
|
2010
|
-
report();
|
|
2011
|
-
}
|
|
2012
|
-
} else if (transformProperties.includes(key)) {
|
|
2013
|
-
if (!transformRegex.test(value) && globalValue) {
|
|
2014
|
-
report();
|
|
2015
|
-
}
|
|
2016
|
-
} else if (transformOriginProperties.includes(key)) {
|
|
2017
|
-
if (!transformOriginRegex.test(value) && globalValue) {
|
|
2018
|
-
report();
|
|
2019
|
-
}
|
|
2020
|
-
} else if (textEmphasisProperties.includes(key)) {
|
|
2021
|
-
if (!textEmphasisRegex.test(value) && globalValue) {
|
|
2022
|
-
report();
|
|
2023
|
-
}
|
|
2024
|
-
} else if (textEmphasisStyleProperties.includes(key)) {
|
|
2025
|
-
if (!textEmphasisStyleRegex.test(value) && globalValue) {
|
|
2026
|
-
report();
|
|
2027
|
-
}
|
|
2028
|
-
} else if (textEmphasisPositionProperties.includes(key)) {
|
|
2029
|
-
if (!textEmphasisPositionRegex.test(value) && globalValue) {
|
|
2030
|
-
report();
|
|
2031
|
-
}
|
|
2032
|
-
} else if (scrollSnapTypeProperties.includes(key)) {
|
|
2033
|
-
if (!scrollSnapTypeRegex.test(value) && globalValue) {
|
|
2034
|
-
report();
|
|
2035
|
-
}
|
|
2036
|
-
} else if (scrollSnapAlignProperties.includes(key)) {
|
|
2037
|
-
if (!scrollSnapAlignRegex.test(value) && globalValue) {
|
|
2038
|
-
report();
|
|
2039
|
-
}
|
|
2040
|
-
} else if (maskBorderRepeatProperties.includes(key)) {
|
|
2041
|
-
if (!maskBorderRepeatRegex.test(value) && globalValue) {
|
|
2042
|
-
report();
|
|
2043
|
-
}
|
|
2044
|
-
} else if (justifyItemsProperties.includes(key)) {
|
|
2045
|
-
if (!justifyItemsRegex.test(value) && globalValue) {
|
|
2046
|
-
report();
|
|
2047
|
-
}
|
|
2048
|
-
} else if (justifySelfProperties.includes(key)) {
|
|
2049
|
-
if (!justifySelfRegex.test(value) && globalValue) {
|
|
2050
|
-
report();
|
|
2051
|
-
}
|
|
2052
|
-
} else if (justifyContentProperties.includes(key)) {
|
|
2053
|
-
if (!justifyContentRegex.test(value) && globalValue) {
|
|
2054
|
-
report();
|
|
2055
|
-
}
|
|
2056
|
-
} else if (hangingPunctuationProperties.includes(key)) {
|
|
2057
|
-
if (!hangingPunctuationRegex.test(value) && globalValue) {
|
|
2058
|
-
report();
|
|
2059
|
-
}
|
|
2060
|
-
} else if (flexFlowProperties.includes(key)) {
|
|
2061
|
-
if (!flexFlowRegex.test(value) && globalValue) {
|
|
2062
|
-
report();
|
|
2063
|
-
}
|
|
2064
|
-
} else if (backgroundRepeatProperties.includes(key)) {
|
|
2065
|
-
if (!backgroundRepeatRegex.test(value) && globalValue) {
|
|
2066
|
-
report();
|
|
2067
|
-
}
|
|
2068
|
-
} else if (placeSelfProperties.includes(key)) {
|
|
2069
|
-
if (!isValidPlaceSelf(value) && globalValue) {
|
|
2070
|
-
report();
|
|
2071
|
-
}
|
|
2072
|
-
} else if (placeItemsProperties.includes(key)) {
|
|
2073
|
-
if (!isValidPlaceItems(value) && globalValue) {
|
|
2074
|
-
report();
|
|
2075
|
-
}
|
|
2076
|
-
} else if (placeContentProperties.includes(key)) {
|
|
2077
|
-
if (!isValidPlaceContent(value) && globalValue) {
|
|
2078
|
-
report();
|
|
2079
|
-
}
|
|
2080
|
-
} else if (displayProperties.includes(key)) {
|
|
2081
|
-
if (!displayRegex.test(value) && globalValue) {
|
|
2082
|
-
report();
|
|
2083
|
-
}
|
|
2084
|
-
} else if (alignItemsSelfProperties.includes(key)) {
|
|
2085
|
-
if (!alignItemsSelfRegex.test(value) && globalValue) {
|
|
2086
|
-
report();
|
|
2087
|
-
}
|
|
2088
|
-
} else if (alignContentProperties.includes(key)) {
|
|
2089
|
-
if (!alignContentRegex.test(value) && globalValue) {
|
|
2090
|
-
report();
|
|
2091
|
-
}
|
|
2092
|
-
} else if (touchActionProperties.includes(key)) {
|
|
2093
|
-
if (!isValidTouchAction(value) && globalValue) {
|
|
2094
|
-
report();
|
|
2095
|
-
}
|
|
2096
|
-
} else if (textShadowProperties.includes(key)) {
|
|
2097
|
-
if (!textShadowRegex.test(value) && globalValue) {
|
|
2098
|
-
report();
|
|
2099
|
-
}
|
|
2100
|
-
} else if (textIndentProperties.includes(key)) {
|
|
2101
|
-
if (!textIndentRegex.test(value) && globalValue) {
|
|
2102
|
-
report();
|
|
2103
|
-
}
|
|
2104
|
-
} else if (textDecorationProperties.includes(key)) {
|
|
2105
|
-
if (!isValidTextDecorationLine(value) && globalValue) {
|
|
2106
|
-
report();
|
|
2107
|
-
}
|
|
2108
|
-
} else if (strokeMiterlimitProperties.includes(key)) {
|
|
2109
|
-
if (!strokeMiterlimitRegex.test(value) && globalValue) {
|
|
2110
|
-
report();
|
|
2111
|
-
}
|
|
2112
|
-
} else if (strokeDasharrayProperties.includes(key)) {
|
|
2113
|
-
if (!strokeDasharrayRegex.test(value) && globalValue) {
|
|
2114
|
-
report();
|
|
2115
|
-
}
|
|
2116
|
-
} else if (strokeProperties.includes(key)) {
|
|
2117
|
-
if (!strokeRegex.test(value) && globalValue) {
|
|
2118
|
-
report();
|
|
2119
|
-
}
|
|
2120
|
-
} else if (shapeOutsideProperties.includes(key)) {
|
|
2121
|
-
if (!shapeOutsideRegex.test(value) && globalValue) {
|
|
2122
|
-
report();
|
|
2123
|
-
}
|
|
2124
|
-
} else if (shapeImageThresholdProperties.includes(key)) {
|
|
2125
|
-
if (!shapeImageThresholdRegex.test(value) && globalValue) {
|
|
2126
|
-
report();
|
|
2127
|
-
}
|
|
2128
|
-
} else if (scrollbarColorProperties.includes(key)) {
|
|
2129
|
-
if (!scrollbarColorRegex.test(value) && globalValue) {
|
|
2130
|
-
report();
|
|
2131
|
-
}
|
|
2132
|
-
} else if (scrollPaddingProperties.includes(key)) {
|
|
2133
|
-
if (!scrollPaddingRegex.test(value) && globalValue) {
|
|
2134
|
-
report();
|
|
2135
|
-
}
|
|
2136
|
-
} else if (scrollMarginProperties.includes(key)) {
|
|
2137
|
-
if (!scrollMarginRegex.test(value) && globalValue) {
|
|
2138
|
-
report();
|
|
2139
|
-
}
|
|
2140
|
-
} else if (scaleProperties.includes(key)) {
|
|
2141
|
-
if (!scaleRegex.test(value) && globalValue) {
|
|
2142
|
-
report();
|
|
2143
|
-
}
|
|
2144
|
-
} else if (rotateProperties.includes(key)) {
|
|
2145
|
-
if (!rotateRegex.test(value) && globalValue) {
|
|
2146
|
-
report();
|
|
2147
|
-
}
|
|
2148
|
-
} else if (quotesProperties.includes(key)) {
|
|
2149
|
-
if (!quotesRegex.test(value) && globalValue) {
|
|
2150
|
-
report();
|
|
2151
|
-
}
|
|
2152
|
-
} else if (paintOrderProperties.includes(key)) {
|
|
2153
|
-
if (!paintOrderRegex.test(value) && globalValue) {
|
|
2154
|
-
report();
|
|
2155
|
-
}
|
|
2156
|
-
} else if (overscrollBehaviorProperties.includes(key)) {
|
|
2157
|
-
if (!overscrollBehaviorRegex.test(value) && globalValue) {
|
|
2158
|
-
report();
|
|
2159
|
-
}
|
|
2160
|
-
} else if (overflowClipMarginProperties.includes(key)) {
|
|
2161
|
-
if (!overflowClipMarginRegex.test(value) && globalValue) {
|
|
2162
|
-
report();
|
|
2163
|
-
}
|
|
2164
|
-
} else if (oveflowProperties.includes(key)) {
|
|
2165
|
-
if (!oveflowRegex.test(value) && globalValue) {
|
|
2166
|
-
report();
|
|
2167
|
-
}
|
|
2168
|
-
} else if (offsetProperties.includes(key)) {
|
|
2169
|
-
if (!offsetRegex.test(value) && globalValue) {
|
|
2170
|
-
report();
|
|
2171
|
-
}
|
|
2172
|
-
} else if (offsetPathProperties.includes(key)) {
|
|
2173
|
-
if (!offsetPathRegex.test(value) && globalValue) {
|
|
2174
|
-
report();
|
|
2175
|
-
}
|
|
2176
|
-
} else if (offsetRotateProperties.includes(key)) {
|
|
2177
|
-
if (!offsetRotateRegex.test(value) && globalValue) {
|
|
2178
|
-
report();
|
|
2179
|
-
}
|
|
2180
|
-
} else if (lengthPositionProperties.includes(key)) {
|
|
2181
|
-
if (!lengthPositionRegex.test(value)) {
|
|
2182
|
-
report();
|
|
2183
|
-
}
|
|
2184
|
-
} else if (mathDepthProperties.includes(key)) {
|
|
2185
|
-
if (!mathDepthRegex.test(value) && globalValue) {
|
|
2186
|
-
report();
|
|
2187
|
-
}
|
|
2188
|
-
} else if (maskProperties.includes(key)) {
|
|
2189
|
-
if (!maskRegex.test(value) && globalValue) {
|
|
2190
|
-
report();
|
|
2191
|
-
}
|
|
2192
|
-
} else if (maskBorderProperties.includes(key)) {
|
|
2193
|
-
if (!maskBorderRegex.test(value) && globalValue) {
|
|
2194
|
-
report();
|
|
2195
|
-
}
|
|
2196
|
-
} else if (maskSizeProperties.includes(key)) {
|
|
2197
|
-
if (!maskSizeRegex.test(value) && globalValue) {
|
|
2198
|
-
report();
|
|
2199
|
-
}
|
|
2200
|
-
} else if (maskRepeatProperties.includes(key)) {
|
|
2201
|
-
if (!maskRepeatRegex.test(value) && globalValue) {
|
|
2202
|
-
report();
|
|
2203
|
-
}
|
|
2204
|
-
} else if (maskPositionProperties.includes(key)) {
|
|
2205
|
-
if (!maskPositionRegex.test(value) && globalValue) {
|
|
2206
|
-
report();
|
|
2207
|
-
}
|
|
2208
|
-
} else if (maskOriginProperties.includes(key)) {
|
|
2209
|
-
if (!maskOriginRegex.test(value) && globalValue) {
|
|
2210
|
-
report();
|
|
2211
|
-
}
|
|
2212
|
-
} else if (maksModeProperties.includes(key)) {
|
|
2213
|
-
if (!maskModeRegex.test(value) && globalValue) {
|
|
2214
|
-
report();
|
|
2215
|
-
}
|
|
2216
|
-
} else if (maskCompositeProperties.includes(key)) {
|
|
2217
|
-
if (!maskCompositeRegex.test(value) && globalValue) {
|
|
2218
|
-
report();
|
|
2219
|
-
}
|
|
2220
|
-
} else if (maskClipProperties.includes(key)) {
|
|
2221
|
-
if (!maskClipRegex.test(value) && globalValue) {
|
|
2222
|
-
report();
|
|
2223
|
-
}
|
|
2224
|
-
} else if (maskBorderWidthProperties.includes(key)) {
|
|
2225
|
-
if (!maskBorderWidthRegex.test(value) && globalValue) {
|
|
2226
|
-
report();
|
|
2227
|
-
}
|
|
2228
|
-
} else if (maskBorderSliceProperties.includes(key)) {
|
|
2229
|
-
if (!maskBorderSliceRegex.test(value) && globalValue) {
|
|
2230
|
-
report();
|
|
2231
|
-
}
|
|
2232
|
-
} else if (maskBorderOutsetProperties.includes(key)) {
|
|
2233
|
-
if (!maskBorderOutsetRegex.test(value) && globalValue) {
|
|
2234
|
-
report();
|
|
2235
|
-
}
|
|
2236
|
-
} else if (markerProperties.includes(key)) {
|
|
2237
|
-
if (!urlRegex.test(value) && globalValue) {
|
|
2238
|
-
report();
|
|
2239
|
-
}
|
|
2240
|
-
} else if (marginPairProperties.includes(key)) {
|
|
2241
|
-
if (!marginPairRegex.test(value) && globalValue) {
|
|
2242
|
-
report();
|
|
2243
|
-
}
|
|
2244
|
-
} else if (insetPairProperties.includes(key)) {
|
|
2245
|
-
if (!insetPairRegex.test(value) && globalValue) {
|
|
2246
|
-
report();
|
|
2247
|
-
}
|
|
2248
|
-
} else if (initialLetterProperties.includes(key)) {
|
|
2249
|
-
if (!initialLetterRegex.test(value) && globalValue) {
|
|
2250
|
-
report();
|
|
2251
|
-
}
|
|
2252
|
-
} else if (imageOrientationProperties.includes(key)) {
|
|
2253
|
-
if (!imageOrientationRegex.test(value) && globalValue) {
|
|
2254
|
-
report();
|
|
2255
|
-
}
|
|
2256
|
-
} else if (hyphenateLimitCharsProperties.includes(key)) {
|
|
2257
|
-
if (!hyphenateLimitCharsRegex.test(value) && globalValue) {
|
|
2258
|
-
report();
|
|
2259
|
-
}
|
|
2260
|
-
} else if (gridProperties.includes(key)) {
|
|
2261
|
-
if (!gridRegex.test(value)) {
|
|
2262
|
-
report();
|
|
2263
|
-
}
|
|
2264
|
-
} else if (gridTemplateProperties.includes(key)) {
|
|
2265
|
-
if (!isValidateGridTemplate(value) && globalValue) {
|
|
2266
|
-
report();
|
|
2267
|
-
}
|
|
2268
|
-
} else if (gridTemplateTrackListProperties.includes(key)) {
|
|
2269
|
-
if (!gridTemplateTrackListRegex.test(value) && globalValue) {
|
|
2270
|
-
report();
|
|
2271
|
-
}
|
|
2272
|
-
} else if (gridTemplateAreasProperties.includes(key)) {
|
|
2273
|
-
if (!quoteRegex.test(value) && globalValue) {
|
|
2274
|
-
report();
|
|
2275
|
-
}
|
|
2276
|
-
} else if (gridAutoColumnsRowsProperties.includes(key)) {
|
|
2277
|
-
if (!gridAutoColumnsRegex.test(value) && globalValue) {
|
|
2278
|
-
report();
|
|
2279
|
-
}
|
|
2280
|
-
} else if (stringNameProperties.includes(key)) {
|
|
2281
|
-
if (!stringNameRegex.test(value) && globalValue) {
|
|
2282
|
-
report();
|
|
2283
|
-
}
|
|
2284
|
-
} else if (fontFeatureSettingsProperties.includes(key)) {
|
|
2285
|
-
if (!fontFeatureSettingsRegex.test(value) && globalValue) {
|
|
2286
|
-
report();
|
|
2287
|
-
}
|
|
2288
|
-
} else if (fontVariantProperties.includes(key)) {
|
|
2289
|
-
if (!fontVariantRegex.test(value) && globalValue) {
|
|
2290
|
-
report();
|
|
2291
|
-
}
|
|
2292
|
-
} else if (fontVariationSettingsProperties.includes(key)) {
|
|
2293
|
-
if (!fontVariationSettingsRegex.test(value) && globalValue) {
|
|
2294
|
-
report();
|
|
2295
|
-
}
|
|
2296
|
-
} else if (fontVariantNumericProperties.includes(key)) {
|
|
2297
|
-
if (!fontVariantNumericRegex.test(value) && globalValue) {
|
|
2298
|
-
report();
|
|
2299
|
-
}
|
|
2300
|
-
} else if (fontVariantLigaturesProperties.includes(key)) {
|
|
2301
|
-
if (!fontVariantLigaturesRegex.test(value) && globalValue) {
|
|
2302
|
-
report();
|
|
2303
|
-
}
|
|
2304
|
-
} else if (fontVariantEastAsianProperties.includes(key)) {
|
|
2305
|
-
if (!isValidFontVariantEastAsian(value) && globalValue) {
|
|
2306
|
-
report();
|
|
2307
|
-
}
|
|
2308
|
-
} else if (fontVariantAlternatesProperties.includes(key)) {
|
|
2309
|
-
if (!fontVariantAlternatesRegex.test(value) && globalValue) {
|
|
2310
|
-
report();
|
|
2311
|
-
}
|
|
2312
|
-
} else if (fontSynthesisProperties.includes(key)) {
|
|
2313
|
-
if (!fontSynthesisRegex.test(value) && globalValue) {
|
|
2314
|
-
report();
|
|
2315
|
-
}
|
|
2316
|
-
} else if (fontStyleProperties.includes(key)) {
|
|
2317
|
-
if (!fontStyleRegex.test(value) && globalValue) {
|
|
2318
|
-
report();
|
|
2319
|
-
}
|
|
2320
|
-
} else if (fontPaletteProperties.includes(key)) {
|
|
2321
|
-
if (!fontPaletteRegex.test(value) && globalValue) {
|
|
2322
|
-
report();
|
|
2323
|
-
}
|
|
2324
|
-
} else if (fontSizeAdjustProperties.includes(key)) {
|
|
2325
|
-
if (!isValidFontSizeAdjust(value) && globalValue) {
|
|
2326
|
-
report();
|
|
2327
|
-
}
|
|
2328
|
-
} else if (stringStringProperties.includes(key)) {
|
|
2329
|
-
if (!stringValueRegex.test(value) && globalValue) {
|
|
2330
|
-
report();
|
|
2331
|
-
}
|
|
2332
|
-
} else if (fontStretchProperties.includes(key)) {
|
|
2333
|
-
if (!percentageValueRegex.test(value) && globalValue) {
|
|
2334
|
-
report();
|
|
2335
|
-
}
|
|
2336
|
-
} else if (flexProperty.includes(key)) {
|
|
2337
|
-
if (!isValidFlexValue(value) && globalValue) {
|
|
2338
|
-
report();
|
|
2339
|
-
}
|
|
2340
|
-
} else if (cursorProperty.includes(key)) {
|
|
2341
|
-
if (!isValidCursor(value) && globalValue) {
|
|
2342
|
-
report();
|
|
2343
|
-
}
|
|
2344
|
-
} else if (contentProperty.includes(key)) {
|
|
2345
|
-
if (!contentValueRegex.test(value) && globalValue) {
|
|
2346
|
-
report();
|
|
2347
|
-
}
|
|
2348
|
-
} else if (columnsProperties.includes(key)) {
|
|
2349
|
-
if (!columnsRegex.test(value) && globalValue) {
|
|
2350
|
-
report();
|
|
2351
|
-
}
|
|
2352
|
-
} else if (clipPathProperties.includes(key)) {
|
|
2353
|
-
if (!clipPathRegex.test(value) && globalValue) {
|
|
2354
|
-
report();
|
|
2355
|
-
}
|
|
2356
|
-
} else if (boxShadowProperties.includes(key)) {
|
|
2357
|
-
if (!boxShadowRegex.test(value) && globalValue) {
|
|
2358
|
-
report();
|
|
2359
|
-
}
|
|
2360
|
-
} else if (backgroundProperties.includes(key)) {
|
|
2361
|
-
if (!backgroundRegex.test(value) && globalValue) {
|
|
2362
|
-
report();
|
|
2363
|
-
}
|
|
2364
|
-
} else if (backgroundAttachmentProperties.includes(key)) {
|
|
2365
|
-
if (!backgroundAttachmentRegex.test(value) && globalValue) {
|
|
2366
|
-
report();
|
|
2367
|
-
}
|
|
2368
|
-
} else if (backgroundBlendModeProperties.includes(key)) {
|
|
2369
|
-
if (!backgroundBlendModeRegex.test(value) && globalValue) {
|
|
2370
|
-
report();
|
|
2371
|
-
}
|
|
2372
|
-
} else if (backgroundImageProperties.includes(key)) {
|
|
2373
|
-
if (!backgroundImageRegex.test(value) && globalValue) {
|
|
2374
|
-
report();
|
|
2375
|
-
}
|
|
2376
|
-
} else if (backgroundOriginProperties.includes(key)) {
|
|
2377
|
-
if (!backgroundOriginRegex.test(value) && globalValue) {
|
|
2378
|
-
report();
|
|
2379
|
-
}
|
|
2380
|
-
} else if (backgroundQuadProperties.includes(key)) {
|
|
2381
|
-
if (!backgroundQuadRegex.test(value) && globalValue) {
|
|
2382
|
-
report();
|
|
2383
|
-
}
|
|
2384
|
-
} else if (backgroundPairProperties.includes(key)) {
|
|
2385
|
-
if (!backgroundPairRegex.test(value) && globalValue) {
|
|
2386
|
-
report();
|
|
2387
|
-
}
|
|
2388
|
-
} else if (filterProperties.includes(key)) {
|
|
2389
|
-
if (!filterRegex.test(value) && globalValue) {
|
|
2390
|
-
report();
|
|
2391
|
-
}
|
|
2392
|
-
} else if (animationTimingFunctionProperties.includes(key)) {
|
|
2393
|
-
if (!animationTimingFunctionRegex.test(value) && globalValue) {
|
|
2394
|
-
report();
|
|
2395
|
-
}
|
|
2396
|
-
} else if (animationIterationCountProperties.includes(key)) {
|
|
2397
|
-
if (!animationIterationCountRegex.test(value) && globalValue) {
|
|
2398
|
-
report();
|
|
2399
|
-
}
|
|
2400
|
-
} else if (animationPlayStateProperties.includes(key)) {
|
|
2401
|
-
if (!animationPlayStateRegex.test(value) && globalValue) {
|
|
2402
|
-
report();
|
|
2403
|
-
}
|
|
2404
|
-
} else if (animationFillModeProperties.includes(key)) {
|
|
2405
|
-
if (!animationFillModeRegex.test(value) && globalValue) {
|
|
2406
|
-
report();
|
|
2407
|
-
}
|
|
2408
|
-
} else if (animationDirectionProperties.includes(key)) {
|
|
2409
|
-
if (!animationDirectionRegex.test(value) && globalValue) {
|
|
2410
|
-
report();
|
|
2411
|
-
}
|
|
2412
|
-
} else if (animationTimeProperties.includes(key)) {
|
|
2413
|
-
if (!animationTimeRegex.test(value) && globalValue) {
|
|
2414
|
-
report();
|
|
2415
|
-
}
|
|
2416
|
-
} else if (aspectRatioProperties.includes(key)) {
|
|
2417
|
-
if (!aspectRatioRegex.test(value) && globalValue) {
|
|
2418
|
-
report();
|
|
2419
|
-
}
|
|
2420
|
-
} else if (borderImageProperties.includes(key)) {
|
|
2421
|
-
if (!borderImageRegex.test(value) && globalValue) {
|
|
2422
|
-
report();
|
|
2423
|
-
}
|
|
2424
|
-
} else if (borderImageSlice.includes(key)) {
|
|
2425
|
-
if (!sliceRegex.test(value) && globalValue) {
|
|
2426
|
-
report();
|
|
2427
|
-
}
|
|
2428
|
-
} else if (ImageSourceProperties.includes(key)) {
|
|
2429
|
-
if (!imageRegex.test(value) && globalValue) {
|
|
2430
|
-
report();
|
|
2431
|
-
}
|
|
2432
|
-
} else if (borderProperties.includes(key)) {
|
|
2433
|
-
if (!isBorderValue(value) && globalValue) {
|
|
2434
|
-
report();
|
|
2435
|
-
}
|
|
2436
|
-
} else if (singleColorProperties.includes(key)) {
|
|
2437
|
-
if (!colorRegex.test(value) && globalValue) {
|
|
2438
|
-
report();
|
|
2439
|
-
}
|
|
2440
|
-
} else if (borderColorProperties.includes(key)) {
|
|
2441
|
-
if (!isValidMultipleColorValues(value) && globalValue) {
|
|
2442
|
-
report();
|
|
2443
|
-
}
|
|
2444
|
-
} else if (integerGroupProperties.includes(key)) {
|
|
2445
|
-
if (!integerValueRegex.test(value) && globalValue) {
|
|
2446
|
-
report();
|
|
2447
|
-
}
|
|
2448
|
-
} else if (otherGroupProperties.includes(key)) {
|
|
2449
|
-
if (!otherSingleValueRegex.test(value) && globalValue) {
|
|
2450
|
-
report();
|
|
2451
|
-
}
|
|
2452
|
-
} else if (lengthValueProperties.includes(key)) {
|
|
2453
|
-
if (!lengthValueRegex.test(value) && globalValue) {
|
|
2454
|
-
report();
|
|
2455
|
-
}
|
|
2456
|
-
} else if (borderRadiusProperties.includes(key)) {
|
|
2457
|
-
if (!borderRadiusRegex.test(value) && globalValue) {
|
|
2458
|
-
report();
|
|
2459
|
-
}
|
|
2460
|
-
} else if (borderStyleProperties.includes(key)) {
|
|
2461
|
-
if (!borderStyleRegex.test(value) && globalValue) {
|
|
2462
|
-
report();
|
|
2463
|
-
}
|
|
2464
|
-
} else if (multipleValueProperties.includes(key)) {
|
|
2465
|
-
if (!multipleValueRegex.test(value) && globalValue) {
|
|
2466
|
-
report();
|
|
2467
|
-
}
|
|
2468
|
-
} else {
|
|
2469
|
-
if (globalValue) {
|
|
2470
|
-
report();
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
});
|
|
2476
|
-
},
|
|
2477
|
-
};
|
|
2478
|
-
},
|
|
2479
|
-
};
|