cssstyle 0.2.37 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/parsers.js +1 -1
- package/lib/properties/alignContent.js +12 -0
- package/lib/properties/alignItems.js +12 -0
- package/lib/properties/flexDirection.js +12 -0
- package/lib/properties/flexFlow.js +12 -0
- package/lib/properties/flexWrap.js +12 -0
- package/lib/properties/justifyContent.js +12 -0
- package/lib/properties/transform.js +12 -0
- package/lib/properties.js +90 -0
- package/package.json +12 -7
- package/tests/tests.js +19 -0
- package/.npmignore +0 -1
package/lib/parsers.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.TYPES = {
|
|
|
21
21
|
// rough regular expressions
|
|
22
22
|
var integerRegEx = /^[\-+]?[0-9]+$/;
|
|
23
23
|
var numberRegEx = /^[\-+]?[0-9]*\.[0-9]+$/;
|
|
24
|
-
var lengthRegEx = /^(0|[\-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px))$/;
|
|
24
|
+
var lengthRegEx = /^(0|[\-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem))$/;
|
|
25
25
|
var percentRegEx = /^[\-+]?[0-9]*\.?[0-9]+%$/;
|
|
26
26
|
var urlRegEx = /^url\(\s*([^\)]*)\s*\)$/;
|
|
27
27
|
var stringRegEx = /^(\"[^\"]*\"|\'[^\']*\')$/;
|
package/lib/properties.js
CHANGED
|
@@ -9,6 +9,28 @@
|
|
|
9
9
|
|
|
10
10
|
var external_dependency_parsers_0 = require("./parsers.js");
|
|
11
11
|
|
|
12
|
+
var alignContent_export_definition;
|
|
13
|
+
alignContent_export_definition = {
|
|
14
|
+
set: function (v) {
|
|
15
|
+
this._setProperty('align-content', v);
|
|
16
|
+
},
|
|
17
|
+
get: function () {
|
|
18
|
+
return this.getPropertyValue('align-content');
|
|
19
|
+
},
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true
|
|
22
|
+
};
|
|
23
|
+
var alignItems_export_definition;
|
|
24
|
+
alignItems_export_definition = {
|
|
25
|
+
set: function (v) {
|
|
26
|
+
this._setProperty('align-items', v);
|
|
27
|
+
},
|
|
28
|
+
get: function () {
|
|
29
|
+
return this.getPropertyValue('align-items');
|
|
30
|
+
},
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true
|
|
33
|
+
};
|
|
12
34
|
var alignmentBaseline_export_definition;
|
|
13
35
|
alignmentBaseline_export_definition = {
|
|
14
36
|
set: function (v) {
|
|
@@ -1402,6 +1424,39 @@ filter_export_definition = {
|
|
|
1402
1424
|
enumerable: true,
|
|
1403
1425
|
configurable: true
|
|
1404
1426
|
};
|
|
1427
|
+
var flexDirection_export_definition;
|
|
1428
|
+
flexDirection_export_definition = {
|
|
1429
|
+
set: function (v) {
|
|
1430
|
+
this._setProperty('flex-direction', v);
|
|
1431
|
+
},
|
|
1432
|
+
get: function () {
|
|
1433
|
+
return this.getPropertyValue('flex-direction');
|
|
1434
|
+
},
|
|
1435
|
+
enumerable: true,
|
|
1436
|
+
configurable: true
|
|
1437
|
+
};
|
|
1438
|
+
var flexFlow_export_definition;
|
|
1439
|
+
flexFlow_export_definition = {
|
|
1440
|
+
set: function (v) {
|
|
1441
|
+
this._setProperty('flex-flow', v);
|
|
1442
|
+
},
|
|
1443
|
+
get: function () {
|
|
1444
|
+
return this.getPropertyValue('flex-flow');
|
|
1445
|
+
},
|
|
1446
|
+
enumerable: true,
|
|
1447
|
+
configurable: true
|
|
1448
|
+
};
|
|
1449
|
+
var flexWrap_export_definition;
|
|
1450
|
+
flexWrap_export_definition = {
|
|
1451
|
+
set: function (v) {
|
|
1452
|
+
this._setProperty('flex-wrap', v);
|
|
1453
|
+
},
|
|
1454
|
+
get: function () {
|
|
1455
|
+
return this.getPropertyValue('flex-wrap');
|
|
1456
|
+
},
|
|
1457
|
+
enumerable: true,
|
|
1458
|
+
configurable: true
|
|
1459
|
+
};
|
|
1405
1460
|
var floodColor_export_definition;
|
|
1406
1461
|
floodColor_export_definition = {
|
|
1407
1462
|
set: function (v) {
|
|
@@ -1674,6 +1729,17 @@ imageRendering_export_definition = {
|
|
|
1674
1729
|
enumerable: true,
|
|
1675
1730
|
configurable: true
|
|
1676
1731
|
};
|
|
1732
|
+
var justifyContent_export_definition;
|
|
1733
|
+
justifyContent_export_definition = {
|
|
1734
|
+
set: function (v) {
|
|
1735
|
+
this._setProperty('justify-content', v);
|
|
1736
|
+
},
|
|
1737
|
+
get: function () {
|
|
1738
|
+
return this.getPropertyValue('justify-content');
|
|
1739
|
+
},
|
|
1740
|
+
enumerable: true,
|
|
1741
|
+
configurable: true
|
|
1742
|
+
};
|
|
1677
1743
|
var kerning_export_definition;
|
|
1678
1744
|
kerning_export_definition = {
|
|
1679
1745
|
set: function (v) {
|
|
@@ -2901,6 +2967,17 @@ top_export_definition = {
|
|
|
2901
2967
|
enumerable: true,
|
|
2902
2968
|
configurable: true
|
|
2903
2969
|
};
|
|
2970
|
+
var transform_export_definition;
|
|
2971
|
+
transform_export_definition = {
|
|
2972
|
+
set: function (v) {
|
|
2973
|
+
this._setProperty('transform', v);
|
|
2974
|
+
},
|
|
2975
|
+
get: function () {
|
|
2976
|
+
return this.getPropertyValue('transform');
|
|
2977
|
+
},
|
|
2978
|
+
enumerable: true,
|
|
2979
|
+
configurable: true
|
|
2980
|
+
};
|
|
2904
2981
|
var unicodeBidi_export_definition;
|
|
2905
2982
|
unicodeBidi_export_definition = {
|
|
2906
2983
|
set: function (v) {
|
|
@@ -5117,6 +5194,10 @@ zoom_export_definition = {
|
|
|
5117
5194
|
|
|
5118
5195
|
module.exports = function (prototype) {
|
|
5119
5196
|
Object.defineProperties(prototype, {
|
|
5197
|
+
alignContent: alignContent_export_definition,
|
|
5198
|
+
"align-content": alignContent_export_definition,
|
|
5199
|
+
alignItems: alignItems_export_definition,
|
|
5200
|
+
"align-items": alignItems_export_definition,
|
|
5120
5201
|
alignmentBaseline: alignmentBaseline_export_definition,
|
|
5121
5202
|
"alignment-baseline": alignmentBaseline_export_definition,
|
|
5122
5203
|
azimuth: azimuth_export_definition,
|
|
@@ -5258,6 +5339,12 @@ module.exports = function (prototype) {
|
|
|
5258
5339
|
fillRule: fillRule_export_definition,
|
|
5259
5340
|
"fill-rule": fillRule_export_definition,
|
|
5260
5341
|
filter: filter_export_definition,
|
|
5342
|
+
flexDirection: flexDirection_export_definition,
|
|
5343
|
+
"flex-direction": flexDirection_export_definition,
|
|
5344
|
+
flexFlow: flexFlow_export_definition,
|
|
5345
|
+
"flex-flow": flexFlow_export_definition,
|
|
5346
|
+
flexWrap: flexWrap_export_definition,
|
|
5347
|
+
"flex-wrap": flexWrap_export_definition,
|
|
5261
5348
|
floodColor: floodColor_export_definition,
|
|
5262
5349
|
"flood-color": floodColor_export_definition,
|
|
5263
5350
|
floodOpacity: floodOpacity_export_definition,
|
|
@@ -5286,6 +5373,8 @@ module.exports = function (prototype) {
|
|
|
5286
5373
|
height: height_export_definition,
|
|
5287
5374
|
imageRendering: imageRendering_export_definition,
|
|
5288
5375
|
"image-rendering": imageRendering_export_definition,
|
|
5376
|
+
justifyContent: justifyContent_export_definition,
|
|
5377
|
+
"justify-content": justifyContent_export_definition,
|
|
5289
5378
|
kerning: kerning_export_definition,
|
|
5290
5379
|
left: left_export_definition,
|
|
5291
5380
|
letterSpacing: letterSpacing_export_definition,
|
|
@@ -5459,6 +5548,7 @@ module.exports = function (prototype) {
|
|
|
5459
5548
|
textUnderlineWidth: textUnderlineWidth_export_definition,
|
|
5460
5549
|
"text-underline-width": textUnderlineWidth_export_definition,
|
|
5461
5550
|
top: top_export_definition,
|
|
5551
|
+
transform: transform_export_definition,
|
|
5462
5552
|
unicodeBidi: unicodeBidi_export_definition,
|
|
5463
5553
|
"unicode-bidi": unicodeBidi_export_definition,
|
|
5464
5554
|
unicodeRange: unicodeRange_export_definition,
|
package/package.json
CHANGED
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
"CSSStyleDeclaration",
|
|
7
7
|
"StyleSheet"
|
|
8
8
|
],
|
|
9
|
-
"version": "0.
|
|
10
|
-
"homepage": "https://github.com/
|
|
9
|
+
"version": "0.3.1",
|
|
10
|
+
"homepage": "https://github.com/jsakas/CSSStyleDeclaration",
|
|
11
11
|
"maintainers": [
|
|
12
12
|
{
|
|
13
|
-
"name": "
|
|
14
|
-
"email": "
|
|
15
|
-
"url": "
|
|
13
|
+
"name": "Jon Sakas",
|
|
14
|
+
"email": "jon.sakas@gmail.com",
|
|
15
|
+
"url": "http://jon.sakas.co/"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"contributors": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Chad Walker",
|
|
21
|
+
"email": "chad@chad-cat-lore-eddie.com",
|
|
22
|
+
"url": "https://github.com/chad3814"
|
|
23
|
+
},
|
|
19
24
|
{
|
|
20
25
|
"name": "Nikita Vasilyev",
|
|
21
26
|
"email": "me@elv1s.ru"
|
|
@@ -27,8 +32,8 @@
|
|
|
27
32
|
"name": "Forbes Lindesay"
|
|
28
33
|
}
|
|
29
34
|
],
|
|
30
|
-
"repository": "
|
|
31
|
-
"bugs": "https://github.com/
|
|
35
|
+
"repository": "jsakas/CSSStyleDeclaration",
|
|
36
|
+
"bugs": "https://github.com/jsakas/CSSStyleDeclaration/issues",
|
|
32
37
|
"directories": {
|
|
33
38
|
"lib": "./lib"
|
|
34
39
|
},
|
package/tests/tests.js
CHANGED
|
@@ -393,6 +393,16 @@ module.exports = {
|
|
|
393
393
|
test.equal(style.marginTop, '0px', 'margin-top is not 0px');
|
|
394
394
|
test.done();
|
|
395
395
|
},
|
|
396
|
+
'Make sure setting ex units to a padding or margin works': function (test) {
|
|
397
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
398
|
+
test.expect(2);
|
|
399
|
+
style.padding = '1ex';
|
|
400
|
+
test.equal(style.cssText, 'padding: 1ex;', 'padding is not 1ex');
|
|
401
|
+
style.margin = '1em';
|
|
402
|
+
style.marginTop = '0.5ex'
|
|
403
|
+
test.equal(style.marginTop, '0.5ex', 'margin-top is not 0.5ex');
|
|
404
|
+
test.done();
|
|
405
|
+
},
|
|
396
406
|
'Make sure setting null to background works': function (test) {
|
|
397
407
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
398
408
|
test.expect(2);
|
|
@@ -401,5 +411,14 @@ module.exports = {
|
|
|
401
411
|
style.background = null;
|
|
402
412
|
test.equal(style.cssText, '', 'cssText is not empty');
|
|
403
413
|
test.done();
|
|
414
|
+
},
|
|
415
|
+
'Flex properties should keep their values': function (test) {
|
|
416
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
417
|
+
test.expect(2);
|
|
418
|
+
style.flexDirection = 'column';
|
|
419
|
+
test.equal(style.cssText, 'flex-direction: column;', 'flex-direction is not column');
|
|
420
|
+
style.flexDirection = 'row';
|
|
421
|
+
test.equal(style.cssText, 'flex-direction: row;', 'flex-direction is not column');
|
|
422
|
+
test.done();
|
|
404
423
|
}
|
|
405
424
|
};
|
package/.npmignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_module
|