cssstyle 1.2.1 → 2.0.0
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/.eslintignore +1 -0
- package/.eslintrc.js +5 -0
- package/.travis.yml +6 -4
- package/AUTHORS +31 -0
- package/{MIT-LICENSE.txt → LICENSE} +0 -0
- package/README.md +7 -19
- package/coverage/clover.xml +2150 -0
- package/coverage/coverage-final.json +86 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/index.html +123 -0
- package/coverage/lcov-report/lib/CSSStyleDeclaration.js.html +834 -0
- package/coverage/lcov-report/lib/allExtraProperties.js.html +813 -0
- package/coverage/lcov-report/lib/allProperties.js.html +1560 -0
- package/coverage/lcov-report/lib/constants.js.html +87 -0
- package/coverage/lcov-report/lib/index.html +149 -0
- package/coverage/lcov-report/lib/parsers.js.html +2193 -0
- package/coverage/lcov-report/lib/properties/azimuth.js.html +270 -0
- package/coverage/lcov-report/lib/properties/background.js.html +126 -0
- package/coverage/lcov-report/lib/properties/backgroundAttachment.js.html +141 -0
- package/coverage/lcov-report/lib/properties/backgroundColor.js.html +177 -0
- package/coverage/lcov-report/lib/properties/backgroundImage.js.html +165 -0
- package/coverage/lcov-report/lib/properties/backgroundPosition.js.html +243 -0
- package/coverage/lcov-report/lib/properties/backgroundRepeat.js.html +165 -0
- package/coverage/lcov-report/lib/properties/border.js.html +168 -0
- package/coverage/lcov-report/lib/properties/borderBottom.js.html +120 -0
- package/coverage/lcov-report/lib/properties/borderBottomColor.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderBottomStyle.js.html +132 -0
- package/coverage/lcov-report/lib/properties/borderBottomWidth.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderCollapse.js.html +147 -0
- package/coverage/lcov-report/lib/properties/borderColor.js.html +159 -0
- package/coverage/lcov-report/lib/properties/borderLeft.js.html +120 -0
- package/coverage/lcov-report/lib/properties/borderLeftColor.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderLeftStyle.js.html +132 -0
- package/coverage/lcov-report/lib/properties/borderLeftWidth.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderRight.js.html +120 -0
- package/coverage/lcov-report/lib/properties/borderRightColor.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderRightStyle.js.html +132 -0
- package/coverage/lcov-report/lib/properties/borderRightWidth.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderSpacing.js.html +192 -0
- package/coverage/lcov-report/lib/properties/borderStyle.js.html +183 -0
- package/coverage/lcov-report/lib/properties/borderTop.js.html +120 -0
- package/coverage/lcov-report/lib/properties/borderTopColor.js.html +117 -0
- package/coverage/lcov-report/lib/properties/borderTopStyle.js.html +132 -0
- package/coverage/lcov-report/lib/properties/borderTopWidth.js.html +120 -0
- package/coverage/lcov-report/lib/properties/borderWidth.js.html +207 -0
- package/coverage/lcov-report/lib/properties/bottom.js.html +111 -0
- package/coverage/lcov-report/lib/properties/clear.js.html +117 -0
- package/coverage/lcov-report/lib/properties/clip.js.html +210 -0
- package/coverage/lcov-report/lib/properties/color.js.html +111 -0
- package/coverage/lcov-report/lib/properties/cssFloat.js.html +105 -0
- package/coverage/lcov-report/lib/properties/flex.js.html +204 -0
- package/coverage/lcov-report/lib/properties/flexBasis.js.html +153 -0
- package/coverage/lcov-report/lib/properties/flexGrow.js.html +126 -0
- package/coverage/lcov-report/lib/properties/flexShrink.js.html +126 -0
- package/coverage/lcov-report/lib/properties/float.js.html +105 -0
- package/coverage/lcov-report/lib/properties/floodColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/font.js.html +198 -0
- package/coverage/lcov-report/lib/properties/fontFamily.js.html +168 -0
- package/coverage/lcov-report/lib/properties/fontSize.js.html +183 -0
- package/coverage/lcov-report/lib/properties/fontStyle.js.html +123 -0
- package/coverage/lcov-report/lib/properties/fontVariant.js.html +123 -0
- package/coverage/lcov-report/lib/properties/fontWeight.js.html +168 -0
- package/coverage/lcov-report/lib/properties/height.js.html +141 -0
- package/coverage/lcov-report/lib/properties/index.html +1111 -0
- package/coverage/lcov-report/lib/properties/left.js.html +111 -0
- package/coverage/lcov-report/lib/properties/lightingColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/lineHeight.js.html +147 -0
- package/coverage/lcov-report/lib/properties/margin.js.html +273 -0
- package/coverage/lcov-report/lib/properties/marginBottom.js.html +108 -0
- package/coverage/lcov-report/lib/properties/marginLeft.js.html +108 -0
- package/coverage/lcov-report/lib/properties/marginRight.js.html +108 -0
- package/coverage/lcov-report/lib/properties/marginTop.js.html +108 -0
- package/coverage/lcov-report/lib/properties/opacity.js.html +111 -0
- package/coverage/lcov-report/lib/properties/outlineColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/padding.js.html +252 -0
- package/coverage/lcov-report/lib/properties/paddingBottom.js.html +108 -0
- package/coverage/lcov-report/lib/properties/paddingLeft.js.html +108 -0
- package/coverage/lcov-report/lib/properties/paddingRight.js.html +108 -0
- package/coverage/lcov-report/lib/properties/paddingTop.js.html +108 -0
- package/coverage/lcov-report/lib/properties/right.js.html +111 -0
- package/coverage/lcov-report/lib/properties/stopColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/textLineThroughColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/textOverlineColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/textUnderlineColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/top.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitBorderAfterColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitBorderBeforeColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitBorderEndColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitBorderStartColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitColumnRuleColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitMatchNearestMailBlockquoteColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitTapHighlightColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitTextEmphasisColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitTextFillColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/webkitTextStrokeColor.js.html +111 -0
- package/coverage/lcov-report/lib/properties/width.js.html +141 -0
- package/coverage/lcov-report/lib/utils/getBasicPropertyDescriptor.js.html +111 -0
- package/coverage/lcov-report/lib/utils/index.html +97 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov.info +3711 -0
- package/jest.config.js +10 -0
- package/lib/CSSStyleDeclaration.test.js +521 -0
- package/lib/allProperties.js +53 -13
- package/lib/implementedProperties.js +1 -1
- package/lib/named_colors.json +3 -1
- package/lib/parsers.js +15 -4
- package/lib/parsers.test.js +98 -0
- package/lib/properties/fontSize.js +11 -1
- package/lib/properties.js +9 -2
- package/package.json +24 -30
- package/.npmignore +0 -1
- package/package-lock.json +0 -3767
- package/tests/tests.js +0 -665
package/lib/allProperties.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// autogenerated -
|
|
3
|
+
// autogenerated - 7/1/2019
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
*
|
|
@@ -12,6 +12,7 @@ module.exports = allProperties;
|
|
|
12
12
|
allProperties.add('align-content');
|
|
13
13
|
allProperties.add('align-items');
|
|
14
14
|
allProperties.add('align-self');
|
|
15
|
+
allProperties.add('alignment-adjust');
|
|
15
16
|
allProperties.add('alignment-baseline');
|
|
16
17
|
allProperties.add('all');
|
|
17
18
|
allProperties.add('animation');
|
|
@@ -25,6 +26,7 @@ allProperties.add('animation-play-state');
|
|
|
25
26
|
allProperties.add('animation-timing-function');
|
|
26
27
|
allProperties.add('appearance');
|
|
27
28
|
allProperties.add('azimuth');
|
|
29
|
+
allProperties.add('backface-visibility');
|
|
28
30
|
allProperties.add('background');
|
|
29
31
|
allProperties.add('background-attachment');
|
|
30
32
|
allProperties.add('background-blend-mode');
|
|
@@ -56,20 +58,37 @@ allProperties.add('border-block-style');
|
|
|
56
58
|
allProperties.add('border-block-width');
|
|
57
59
|
allProperties.add('border-bottom');
|
|
58
60
|
allProperties.add('border-bottom-color');
|
|
61
|
+
allProperties.add('border-bottom-fit-length');
|
|
62
|
+
allProperties.add('border-bottom-fit-width');
|
|
63
|
+
allProperties.add('border-bottom-image');
|
|
64
|
+
allProperties.add('border-bottom-left-fit-width');
|
|
65
|
+
allProperties.add('border-bottom-left-image');
|
|
59
66
|
allProperties.add('border-bottom-left-radius');
|
|
67
|
+
allProperties.add('border-bottom-right-fit-length');
|
|
68
|
+
allProperties.add('border-bottom-right-fit-width');
|
|
69
|
+
allProperties.add('border-bottom-right-image');
|
|
60
70
|
allProperties.add('border-bottom-right-radius');
|
|
61
71
|
allProperties.add('border-bottom-style');
|
|
62
72
|
allProperties.add('border-bottom-width');
|
|
73
|
+
allProperties.add('border-bottoml-eft-fit-length');
|
|
63
74
|
allProperties.add('border-boundary');
|
|
75
|
+
allProperties.add('border-break');
|
|
64
76
|
allProperties.add('border-collapse');
|
|
65
77
|
allProperties.add('border-color');
|
|
78
|
+
allProperties.add('border-corner-fit');
|
|
79
|
+
allProperties.add('border-corner-image');
|
|
80
|
+
allProperties.add('border-corner-image-transform');
|
|
66
81
|
allProperties.add('border-end-end-radius');
|
|
67
82
|
allProperties.add('border-end-start-radius');
|
|
83
|
+
allProperties.add('border-fit');
|
|
84
|
+
allProperties.add('border-fit-length');
|
|
85
|
+
allProperties.add('border-fit-width');
|
|
68
86
|
allProperties.add('border-image');
|
|
69
87
|
allProperties.add('border-image-outset');
|
|
70
88
|
allProperties.add('border-image-repeat');
|
|
71
89
|
allProperties.add('border-image-slice');
|
|
72
90
|
allProperties.add('border-image-source');
|
|
91
|
+
allProperties.add('border-image-transform');
|
|
73
92
|
allProperties.add('border-image-width');
|
|
74
93
|
allProperties.add('border-inline');
|
|
75
94
|
allProperties.add('border-inline-color');
|
|
@@ -85,11 +104,17 @@ allProperties.add('border-inline-style');
|
|
|
85
104
|
allProperties.add('border-inline-width');
|
|
86
105
|
allProperties.add('border-left');
|
|
87
106
|
allProperties.add('border-left-color');
|
|
107
|
+
allProperties.add('border-left-fit-length');
|
|
108
|
+
allProperties.add('border-left-fit-width');
|
|
109
|
+
allProperties.add('border-left-image');
|
|
88
110
|
allProperties.add('border-left-style');
|
|
89
111
|
allProperties.add('border-left-width');
|
|
90
112
|
allProperties.add('border-radius');
|
|
91
113
|
allProperties.add('border-right');
|
|
92
114
|
allProperties.add('border-right-color');
|
|
115
|
+
allProperties.add('border-right-fit-length');
|
|
116
|
+
allProperties.add('border-right-fit-width');
|
|
117
|
+
allProperties.add('border-right-image');
|
|
93
118
|
allProperties.add('border-right-style');
|
|
94
119
|
allProperties.add('border-right-width');
|
|
95
120
|
allProperties.add('border-spacing');
|
|
@@ -98,7 +123,16 @@ allProperties.add('border-start-start-radius');
|
|
|
98
123
|
allProperties.add('border-style');
|
|
99
124
|
allProperties.add('border-top');
|
|
100
125
|
allProperties.add('border-top-color');
|
|
126
|
+
allProperties.add('border-top-fit-length');
|
|
127
|
+
allProperties.add('border-top-fit-width');
|
|
128
|
+
allProperties.add('border-top-image');
|
|
129
|
+
allProperties.add('border-top-left-fit-length');
|
|
130
|
+
allProperties.add('border-top-left-fit-width');
|
|
131
|
+
allProperties.add('border-top-left-image');
|
|
101
132
|
allProperties.add('border-top-left-radius');
|
|
133
|
+
allProperties.add('border-top-right-fit-length');
|
|
134
|
+
allProperties.add('border-top-right-fit-width');
|
|
135
|
+
allProperties.add('border-top-right-image');
|
|
102
136
|
allProperties.add('border-top-right-radius');
|
|
103
137
|
allProperties.add('border-top-style');
|
|
104
138
|
allProperties.add('border-top-width');
|
|
@@ -121,7 +155,9 @@ allProperties.add('clip');
|
|
|
121
155
|
allProperties.add('clip-path');
|
|
122
156
|
allProperties.add('clip-rule');
|
|
123
157
|
allProperties.add('color');
|
|
158
|
+
allProperties.add('color-adjust');
|
|
124
159
|
allProperties.add('color-interpolation-filters');
|
|
160
|
+
allProperties.add('color-scheme');
|
|
125
161
|
allProperties.add('column-count');
|
|
126
162
|
allProperties.add('column-fill');
|
|
127
163
|
allProperties.add('column-gap');
|
|
@@ -145,6 +181,12 @@ allProperties.add('cursor');
|
|
|
145
181
|
allProperties.add('direction');
|
|
146
182
|
allProperties.add('display');
|
|
147
183
|
allProperties.add('dominant-baseline');
|
|
184
|
+
allProperties.add('drop-initial-after-adjust');
|
|
185
|
+
allProperties.add('drop-initial-after-align');
|
|
186
|
+
allProperties.add('drop-initial-before-adjust');
|
|
187
|
+
allProperties.add('drop-initial-before-align');
|
|
188
|
+
allProperties.add('drop-initial-size');
|
|
189
|
+
allProperties.add('drop-initial-value');
|
|
148
190
|
allProperties.add('elevation');
|
|
149
191
|
allProperties.add('empty-cells');
|
|
150
192
|
allProperties.add('filter');
|
|
@@ -190,6 +232,7 @@ allProperties.add('font-variation-settings');
|
|
|
190
232
|
allProperties.add('font-weight');
|
|
191
233
|
allProperties.add('footnote-display');
|
|
192
234
|
allProperties.add('footnote-policy');
|
|
235
|
+
allProperties.add('forced-color-adjust');
|
|
193
236
|
allProperties.add('gap');
|
|
194
237
|
allProperties.add('glyph-orientation-vertical');
|
|
195
238
|
allProperties.add('grid');
|
|
@@ -220,6 +263,7 @@ allProperties.add('image-resolution');
|
|
|
220
263
|
allProperties.add('initial-letters');
|
|
221
264
|
allProperties.add('initial-letters-align');
|
|
222
265
|
allProperties.add('initial-letters-wrap');
|
|
266
|
+
allProperties.add('inline-box-align');
|
|
223
267
|
allProperties.add('inline-size');
|
|
224
268
|
allProperties.add('inline-sizing');
|
|
225
269
|
allProperties.add('inset');
|
|
@@ -242,6 +286,10 @@ allProperties.add('line-grid');
|
|
|
242
286
|
allProperties.add('line-height');
|
|
243
287
|
allProperties.add('line-padding');
|
|
244
288
|
allProperties.add('line-snap');
|
|
289
|
+
allProperties.add('line-stacking');
|
|
290
|
+
allProperties.add('line-stacking-ruby');
|
|
291
|
+
allProperties.add('line-stacking-shift');
|
|
292
|
+
allProperties.add('line-stacking-strategy');
|
|
245
293
|
allProperties.add('list-style');
|
|
246
294
|
allProperties.add('list-style-image');
|
|
247
295
|
allProperties.add('list-style-position');
|
|
@@ -334,6 +382,8 @@ allProperties.add('page-break-inside');
|
|
|
334
382
|
allProperties.add('pause');
|
|
335
383
|
allProperties.add('pause-after');
|
|
336
384
|
allProperties.add('pause-before');
|
|
385
|
+
allProperties.add('perspective');
|
|
386
|
+
allProperties.add('perspective-origin');
|
|
337
387
|
allProperties.add('pitch');
|
|
338
388
|
allProperties.add('pitch-range');
|
|
339
389
|
allProperties.add('place-content');
|
|
@@ -341,13 +391,9 @@ allProperties.add('place-items');
|
|
|
341
391
|
allProperties.add('place-self');
|
|
342
392
|
allProperties.add('play-during');
|
|
343
393
|
allProperties.add('position');
|
|
344
|
-
allProperties.add('presentation-level');
|
|
345
394
|
allProperties.add('quotes');
|
|
346
395
|
allProperties.add('region-fragment');
|
|
347
396
|
allProperties.add('resize');
|
|
348
|
-
allProperties.add('rest');
|
|
349
|
-
allProperties.add('rest-after');
|
|
350
|
-
allProperties.add('rest-before');
|
|
351
397
|
allProperties.add('richness');
|
|
352
398
|
allProperties.add('right');
|
|
353
399
|
allProperties.add('row-gap');
|
|
@@ -386,7 +432,6 @@ allProperties.add('shape-inside');
|
|
|
386
432
|
allProperties.add('shape-margin');
|
|
387
433
|
allProperties.add('shape-outside');
|
|
388
434
|
allProperties.add('speak');
|
|
389
|
-
allProperties.add('speak-as');
|
|
390
435
|
allProperties.add('speak-header');
|
|
391
436
|
allProperties.add('speak-numeral');
|
|
392
437
|
allProperties.add('speak-punctuation');
|
|
@@ -408,6 +453,7 @@ allProperties.add('text-emphasis-color');
|
|
|
408
453
|
allProperties.add('text-emphasis-position');
|
|
409
454
|
allProperties.add('text-emphasis-style');
|
|
410
455
|
allProperties.add('text-group-align');
|
|
456
|
+
allProperties.add('text-height');
|
|
411
457
|
allProperties.add('text-indent');
|
|
412
458
|
allProperties.add('text-justify');
|
|
413
459
|
allProperties.add('text-orientation');
|
|
@@ -423,6 +469,7 @@ allProperties.add('top');
|
|
|
423
469
|
allProperties.add('transform');
|
|
424
470
|
allProperties.add('transform-box');
|
|
425
471
|
allProperties.add('transform-origin');
|
|
472
|
+
allProperties.add('transform-style');
|
|
426
473
|
allProperties.add('transition');
|
|
427
474
|
allProperties.add('transition-delay');
|
|
428
475
|
allProperties.add('transition-duration');
|
|
@@ -432,14 +479,7 @@ allProperties.add('unicode-bidi');
|
|
|
432
479
|
allProperties.add('user-select');
|
|
433
480
|
allProperties.add('vertical-align');
|
|
434
481
|
allProperties.add('visibility');
|
|
435
|
-
allProperties.add('voice-balance');
|
|
436
|
-
allProperties.add('voice-duration');
|
|
437
482
|
allProperties.add('voice-family');
|
|
438
|
-
allProperties.add('voice-pitch');
|
|
439
|
-
allProperties.add('voice-range');
|
|
440
|
-
allProperties.add('voice-rate');
|
|
441
|
-
allProperties.add('voice-stress');
|
|
442
|
-
allProperties.add('voice-volume');
|
|
443
483
|
allProperties.add('volume');
|
|
444
484
|
allProperties.add('white-space');
|
|
445
485
|
allProperties.add('widows');
|
package/lib/named_colors.json
CHANGED
package/lib/parsers.js
CHANGED
|
@@ -21,12 +21,12 @@ exports.TYPES = {
|
|
|
21
21
|
|
|
22
22
|
// rough regular expressions
|
|
23
23
|
var integerRegEx = /^[-+]?[0-9]+$/;
|
|
24
|
-
var numberRegEx = /^[-+]?[0-9]
|
|
24
|
+
var numberRegEx = /^[-+]?[0-9]*\.?[0-9]+$/;
|
|
25
25
|
var lengthRegEx = /^(0|[-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem|vh|vw))$/;
|
|
26
26
|
var percentRegEx = /^[-+]?[0-9]*\.?[0-9]+%$/;
|
|
27
27
|
var urlRegEx = /^url\(\s*([^)]*)\s*\)$/;
|
|
28
28
|
var stringRegEx = /^("[^"]*"|'[^']*')$/;
|
|
29
|
-
var colorRegEx1 = /^#
|
|
29
|
+
var colorRegEx1 = /^#([0-9a-fA-F]{3,4}){1,2}$/;
|
|
30
30
|
var colorRegEx2 = /^rgb\(([^)]*)\)$/;
|
|
31
31
|
var colorRegEx3 = /^rgba\(([^)]*)\)$/;
|
|
32
32
|
var colorRegEx4 = /^hsla?\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*(,\s*(-?\d+|-?\d*.\d+)\s*)?\)/;
|
|
@@ -287,15 +287,26 @@ exports.parseColor = function parseColor(val) {
|
|
|
287
287
|
alpha = 1;
|
|
288
288
|
var parts;
|
|
289
289
|
var res = colorRegEx1.exec(val);
|
|
290
|
-
// is it #aaa
|
|
290
|
+
// is it #aaa, #ababab, #aaaa, #abababaa
|
|
291
291
|
if (res) {
|
|
292
|
+
var defaultHex = val.substr(1);
|
|
292
293
|
var hex = val.substr(1);
|
|
293
|
-
if (hex.length === 3) {
|
|
294
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
294
295
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
296
|
+
|
|
297
|
+
if (defaultHex.length === 4) {
|
|
298
|
+
hex = hex + defaultHex[3] + defaultHex[3];
|
|
299
|
+
}
|
|
295
300
|
}
|
|
296
301
|
red = parseInt(hex.substr(0, 2), 16);
|
|
297
302
|
green = parseInt(hex.substr(2, 2), 16);
|
|
298
303
|
blue = parseInt(hex.substr(4, 2), 16);
|
|
304
|
+
if (hex.length === 8) {
|
|
305
|
+
var hexAlpha = hex.substr(6, 2);
|
|
306
|
+
var hexAlphaToRgbaAlpha = Number((parseInt(hexAlpha, 16) / 255).toFixed(3));
|
|
307
|
+
|
|
308
|
+
return 'rgba(' + red + ', ' + green + ', ' + blue + ', ' + hexAlphaToRgbaAlpha + ')';
|
|
309
|
+
}
|
|
299
310
|
return 'rgb(' + red + ', ' + green + ', ' + blue + ')';
|
|
300
311
|
}
|
|
301
312
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const parsers = require('./parsers');
|
|
4
|
+
|
|
5
|
+
describe('valueType', () => {
|
|
6
|
+
it('returns color for red', () => {
|
|
7
|
+
let input = 'red';
|
|
8
|
+
let output = parsers.valueType(input);
|
|
9
|
+
|
|
10
|
+
expect(output).toEqual(parsers.TYPES.COLOR);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('returns color for #nnnnnn', () => {
|
|
14
|
+
let input = '#fefefe';
|
|
15
|
+
let output = parsers.valueType(input);
|
|
16
|
+
|
|
17
|
+
expect(output).toEqual(parsers.TYPES.COLOR);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('returns color for rgb(n, n, n)', () => {
|
|
21
|
+
let input = 'rgb(10, 10, 10)';
|
|
22
|
+
let output = parsers.valueType(input);
|
|
23
|
+
|
|
24
|
+
expect(output).toEqual(parsers.TYPES.COLOR);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('returns color for rgb(p, p, p)', () => {
|
|
28
|
+
let input = 'rgb(10%, 10%, 10%)';
|
|
29
|
+
let output = parsers.valueType(input);
|
|
30
|
+
|
|
31
|
+
expect(output).toEqual(parsers.TYPES.COLOR);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('returns color for rgba(n, n, n, n)', () => {
|
|
35
|
+
let input = 'rgba(10, 10, 10, 1)';
|
|
36
|
+
let output = parsers.valueType(input);
|
|
37
|
+
|
|
38
|
+
expect(output).toEqual(parsers.TYPES.COLOR);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('returns color for rgba(p, p, p, n)', () => {
|
|
42
|
+
let input = 'rgba(10%, 10%, 10%, 1)';
|
|
43
|
+
let output = parsers.valueType(input);
|
|
44
|
+
|
|
45
|
+
expect(output).toEqual(parsers.TYPES.COLOR);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('parseInteger', () => {
|
|
49
|
+
it.todo('test');
|
|
50
|
+
});
|
|
51
|
+
describe('parseNumber', () => {
|
|
52
|
+
it.todo('test');
|
|
53
|
+
});
|
|
54
|
+
describe('parseLength', () => {
|
|
55
|
+
it.todo('test');
|
|
56
|
+
});
|
|
57
|
+
describe('parsePercent', () => {
|
|
58
|
+
it.todo('test');
|
|
59
|
+
});
|
|
60
|
+
describe('parseMeasurement', () => {
|
|
61
|
+
it.todo('test');
|
|
62
|
+
});
|
|
63
|
+
describe('parseUrl', () => {
|
|
64
|
+
it.todo('test');
|
|
65
|
+
});
|
|
66
|
+
describe('parseString', () => {
|
|
67
|
+
it.todo('test');
|
|
68
|
+
});
|
|
69
|
+
describe('parseColor', () => {
|
|
70
|
+
it.todo('test');
|
|
71
|
+
});
|
|
72
|
+
describe('parseAngle', () => {
|
|
73
|
+
it.todo('test');
|
|
74
|
+
});
|
|
75
|
+
describe('parseKeyword', () => {
|
|
76
|
+
it.todo('test');
|
|
77
|
+
});
|
|
78
|
+
describe('dashedToCamelCase', () => {
|
|
79
|
+
it.todo('test');
|
|
80
|
+
});
|
|
81
|
+
describe('shorthandParser', () => {
|
|
82
|
+
it.todo('test');
|
|
83
|
+
});
|
|
84
|
+
describe('shorthandSetter', () => {
|
|
85
|
+
it.todo('test');
|
|
86
|
+
});
|
|
87
|
+
describe('shorthandGetter', () => {
|
|
88
|
+
it.todo('test');
|
|
89
|
+
});
|
|
90
|
+
describe('implicitSetter', () => {
|
|
91
|
+
it.todo('test');
|
|
92
|
+
});
|
|
93
|
+
describe('subImplicitSetter', () => {
|
|
94
|
+
it.todo('test');
|
|
95
|
+
});
|
|
96
|
+
describe('camelToDashed', () => {
|
|
97
|
+
it.todo('test');
|
|
98
|
+
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var TYPES = require('../parsers').TYPES;
|
|
4
4
|
var valueType = require('../parsers').valueType;
|
|
5
|
+
var parseMeasurement = require('../parsers').parseMeasurement;
|
|
5
6
|
|
|
6
7
|
var absoluteSizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
|
|
7
8
|
var relativeSizes = ['larger', 'smaller'];
|
|
@@ -16,9 +17,18 @@ module.exports.isValid = function(v) {
|
|
|
16
17
|
);
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
function parse(v) {
|
|
21
|
+
const valueAsString = String(v).toLowerCase();
|
|
22
|
+
const optionalArguments = absoluteSizes.concat(relativeSizes);
|
|
23
|
+
const isOptionalArgument = optionalArguments.some(
|
|
24
|
+
stringValue => stringValue.toLowerCase() === valueAsString
|
|
25
|
+
);
|
|
26
|
+
return isOptionalArgument ? valueAsString : parseMeasurement(v);
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
module.exports.definition = {
|
|
20
30
|
set: function(v) {
|
|
21
|
-
this._setProperty('font-size', v);
|
|
31
|
+
this._setProperty('font-size', parse(v));
|
|
22
32
|
},
|
|
23
33
|
get: function() {
|
|
24
34
|
return this.getPropertyValue('font-size');
|
package/lib/properties.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// autogenerated -
|
|
3
|
+
// autogenerated - 7/15/2019
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
*
|
|
@@ -1040,9 +1040,16 @@ fontSize_export_isValid = function (v) {
|
|
|
1040
1040
|
return type === external_dependency_parsers_0.TYPES.LENGTH || type === external_dependency_parsers_0.TYPES.PERCENT || type === external_dependency_parsers_0.TYPES.KEYWORD && fontSize_local_var_absoluteSizes.indexOf(v.toLowerCase()) !== -1 || type === external_dependency_parsers_0.TYPES.KEYWORD && fontSize_local_var_relativeSizes.indexOf(v.toLowerCase()) !== -1;
|
|
1041
1041
|
};
|
|
1042
1042
|
|
|
1043
|
+
function fontSize_local_fn_parse(v) {
|
|
1044
|
+
const valueAsString = String(v).toLowerCase();
|
|
1045
|
+
const optionalArguments = fontSize_local_var_absoluteSizes.concat(fontSize_local_var_relativeSizes);
|
|
1046
|
+
const isOptionalArgument = optionalArguments.some(stringValue => stringValue.toLowerCase() === valueAsString);
|
|
1047
|
+
return isOptionalArgument ? valueAsString : external_dependency_parsers_0.parseMeasurement(v);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1043
1050
|
fontSize_export_definition = {
|
|
1044
1051
|
set: function (v) {
|
|
1045
|
-
this._setProperty('font-size', v);
|
|
1052
|
+
this._setProperty('font-size', fontSize_local_fn_parse(v));
|
|
1046
1053
|
},
|
|
1047
1054
|
get: function () {
|
|
1048
1055
|
return this.getPropertyValue('font-size');
|
package/package.json
CHANGED
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
"CSSStyleDeclaration",
|
|
7
7
|
"StyleSheet"
|
|
8
8
|
],
|
|
9
|
-
"version": "
|
|
10
|
-
"homepage": "https://github.com/
|
|
9
|
+
"version": "2.0.0",
|
|
10
|
+
"homepage": "https://github.com/jsdom/cssstyle",
|
|
11
11
|
"maintainers": [
|
|
12
12
|
{
|
|
13
13
|
"name": "Jon Sakas",
|
|
14
14
|
"email": "jon.sakas@gmail.com",
|
|
15
15
|
"url": "https://jon.sakas.co/"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Rafał Ruciński",
|
|
19
|
+
"email": "fatfisz@gmail.com",
|
|
20
|
+
"url": "https://fatfisz.com"
|
|
16
21
|
}
|
|
17
22
|
],
|
|
18
23
|
"contributors": [
|
|
@@ -20,45 +25,30 @@
|
|
|
20
25
|
"name": "Chad Walker",
|
|
21
26
|
"email": "chad@chad-cat-lore-eddie.com",
|
|
22
27
|
"url": "https://github.com/chad3814"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "Rafał Ruciński",
|
|
26
|
-
"email": "fatfisz@gmail.com",
|
|
27
|
-
"url": "https://fatfisz.com"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "Nikita Vasilyev",
|
|
31
|
-
"email": "me@elv1s.ru"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "Davide P. Cervone"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "Forbes Lindesay"
|
|
38
28
|
}
|
|
39
29
|
],
|
|
40
|
-
"repository": "
|
|
41
|
-
"bugs": "https://github.com/
|
|
30
|
+
"repository": "jsdom/cssstyle",
|
|
31
|
+
"bugs": "https://github.com/jsdom/cssstyle/issues",
|
|
42
32
|
"directories": {
|
|
43
33
|
"lib": "./lib"
|
|
44
34
|
},
|
|
45
35
|
"main": "./lib/CSSStyleDeclaration.js",
|
|
46
36
|
"dependencies": {
|
|
47
|
-
"cssom": "0.3.
|
|
37
|
+
"cssom": "~0.3.6"
|
|
48
38
|
},
|
|
49
39
|
"devDependencies": {
|
|
50
40
|
"babel-generator": "~6.26.1",
|
|
51
41
|
"babel-traverse": "~6.26.0",
|
|
52
42
|
"babel-types": "~6.26.0",
|
|
53
43
|
"babylon": "~6.18.0",
|
|
54
|
-
"eslint": "
|
|
55
|
-
"eslint-config-prettier": "
|
|
56
|
-
"eslint-plugin-prettier": "3.0
|
|
57
|
-
"
|
|
44
|
+
"eslint": "~6.0.0",
|
|
45
|
+
"eslint-config-prettier": "~6.0.0",
|
|
46
|
+
"eslint-plugin-prettier": "~3.1.0",
|
|
47
|
+
"jest": "^24.8.0",
|
|
58
48
|
"npm-run-all": "^4.1.5",
|
|
59
|
-
"prettier": "1.
|
|
49
|
+
"prettier": "~1.18.0",
|
|
60
50
|
"request": "^2.88.0",
|
|
61
|
-
"resolve": "~1.
|
|
51
|
+
"resolve": "~1.11.1"
|
|
62
52
|
},
|
|
63
53
|
"scripts": {
|
|
64
54
|
"download": "node ./scripts/download_latest_properties.js && eslint lib/allProperties.js --fix",
|
|
@@ -67,9 +57,13 @@
|
|
|
67
57
|
"generate:properties": "node ./scripts/generate_properties.js",
|
|
68
58
|
"lint": "npm run generate && eslint . --max-warnings 0",
|
|
69
59
|
"lint:fix": "eslint . --fix --max-warnings 0",
|
|
70
|
-
"prepublishOnly": "test
|
|
71
|
-
"test": "npm run generate &&
|
|
72
|
-
"test-ci": "npm run lint && npm run test"
|
|
60
|
+
"prepublishOnly": "npm run lint && npm run test",
|
|
61
|
+
"test": "npm run generate && jest",
|
|
62
|
+
"test-ci": "npm run lint && npm run test && codecov",
|
|
63
|
+
"update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS"
|
|
73
64
|
},
|
|
74
|
-
"license": "MIT"
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=8"
|
|
68
|
+
}
|
|
75
69
|
}
|
package/.npmignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_module
|