cssstyle 2.2.0 → 2.3.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.
@@ -547,4 +547,10 @@ describe('CSSStyleDeclaration', () => {
547
547
  expect(style.getPropertyValue('--foo')).toEqual('');
548
548
  expect(style.getPropertyValue('--fOo')).toEqual('purple');
549
549
  });
550
+
551
+ test('supports calc', () => {
552
+ const style = new CSSStyleDeclaration();
553
+ style.setProperty('width', 'calc(100% - 100px)');
554
+ expect(style.getPropertyValue('width')).toEqual('calc(100% - 100px)');
555
+ });
550
556
  });
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // autogenerated - 1/20/2020
3
+ // autogenerated - 4/29/2020
4
4
 
5
5
  /*
6
6
  *
@@ -258,7 +258,6 @@ module.exports = new Set([
258
258
  'margin-left',
259
259
  'margin-right',
260
260
  'margin-top',
261
- 'margin-trim',
262
261
  'marker-side',
263
262
  'mask',
264
263
  'mask-border',
@@ -345,6 +344,9 @@ module.exports = new Set([
345
344
  'quotes',
346
345
  'region-fragment',
347
346
  'resize',
347
+ 'rest',
348
+ 'rest-after',
349
+ 'rest-before',
348
350
  'richness',
349
351
  'right',
350
352
  'row-gap',
@@ -386,6 +388,7 @@ module.exports = new Set([
386
388
  'spatial-navigation-contain',
387
389
  'spatial-navigation-function',
388
390
  'speak',
391
+ 'speak-as',
389
392
  'speak-header',
390
393
  'speak-numeral',
391
394
  'speak-punctuation',
@@ -431,7 +434,14 @@ module.exports = new Set([
431
434
  'user-select',
432
435
  'vertical-align',
433
436
  'visibility',
437
+ 'voice-balance',
438
+ 'voice-duration',
434
439
  'voice-family',
440
+ 'voice-pitch',
441
+ 'voice-range',
442
+ 'voice-rate',
443
+ 'voice-stress',
444
+ 'voice-volume',
435
445
  'volume',
436
446
  'white-space',
437
447
  'widows',
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // autogenerated - 1/23/2020
3
+ // autogenerated - 4/29/2020
4
4
 
5
5
  /*
6
6
  *
package/lib/parsers.js CHANGED
@@ -18,6 +18,7 @@ exports.TYPES = {
18
18
  ANGLE: 8,
19
19
  KEYWORD: 9,
20
20
  NULL_OR_EMPTY_STR: 10,
21
+ CALC: 11,
21
22
  };
22
23
 
23
24
  // rough regular expressions
@@ -30,6 +31,7 @@ var stringRegEx = /^("[^"]*"|'[^']*')$/;
30
31
  var colorRegEx1 = /^#([0-9a-fA-F]{3,4}){1,2}$/;
31
32
  var colorRegEx2 = /^rgb\(([^)]*)\)$/;
32
33
  var colorRegEx3 = /^rgba\(([^)]*)\)$/;
34
+ var calcRegEx = /^calc\(([^)]*)\)$/;
33
35
  var colorRegEx4 = /^hsla?\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*(,\s*(-?\d+|-?\d*.\d+)\s*)?\)/;
34
36
  var angleRegEx = /^([-+]?[0-9]*\.?[0-9]+)(deg|grad|rad)$/;
35
37
 
@@ -61,6 +63,9 @@ exports.valueType = function valueType(val) {
61
63
  if (urlRegEx.test(val)) {
62
64
  return exports.TYPES.URL;
63
65
  }
66
+ if (calcRegEx.test(val)) {
67
+ return exports.TYPES.CALC;
68
+ }
64
69
  if (stringRegEx.test(val)) {
65
70
  return exports.TYPES.STRING;
66
71
  }
@@ -70,6 +75,7 @@ exports.valueType = function valueType(val) {
70
75
  if (colorRegEx1.test(val)) {
71
76
  return exports.TYPES.COLOR;
72
77
  }
78
+
73
79
  var res = colorRegEx2.exec(val);
74
80
  var parts;
75
81
  if (res !== null) {
@@ -201,6 +207,11 @@ exports.parsePercent = function parsePercent(val) {
201
207
 
202
208
  // either a length or a percent
203
209
  exports.parseMeasurement = function parseMeasurement(val) {
210
+ var type = exports.valueType(val);
211
+ if (type === exports.TYPES.CALC) {
212
+ return val;
213
+ }
214
+
204
215
  var length = exports.parseLength(val);
205
216
  if (length !== undefined) {
206
217
  return length;
@@ -65,6 +65,13 @@ describe('valueType', () => {
65
65
 
66
66
  expect(output).toEqual(parsers.TYPES.LENGTH);
67
67
  });
68
+
69
+ it('returns calc from calc(100px * 2)', () => {
70
+ let input = 'calc(100px * 2)';
71
+ let output = parsers.valueType(input);
72
+
73
+ expect(output).toEqual(parsers.TYPES.CALC);
74
+ });
68
75
  });
69
76
  describe('parseInteger', () => {
70
77
  it.todo('test');
package/lib/properties.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // autogenerated - 1/23/2020
3
+ // autogenerated - 4/29/2020
4
4
 
5
5
  /*
6
6
  *
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "CSSStyleDeclaration",
7
7
  "StyleSheet"
8
8
  ],
9
- "version": "2.2.0",
9
+ "version": "2.3.0",
10
10
  "homepage": "https://github.com/jsdom/cssstyle",
11
11
  "maintainers": [
12
12
  {