1 | "use strict";
|
---|
2 |
|
---|
3 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
---|
4 |
|
---|
5 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
---|
6 |
|
---|
7 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
---|
8 |
|
---|
9 | var Declaration = require('../declaration');
|
---|
10 |
|
---|
11 | var utils = require('./grid-utils');
|
---|
12 |
|
---|
13 | var PlaceSelf = /*#__PURE__*/function (_Declaration) {
|
---|
14 | _inheritsLoose(PlaceSelf, _Declaration);
|
---|
15 |
|
---|
16 | function PlaceSelf() {
|
---|
17 | return _Declaration.apply(this, arguments) || this;
|
---|
18 | }
|
---|
19 |
|
---|
20 | var _proto = PlaceSelf.prototype;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Translate place-self to separate -ms- prefixed properties
|
---|
24 | */
|
---|
25 | _proto.insert = function insert(decl, prefix, prefixes) {
|
---|
26 | if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes); // prevent doubling of prefixes
|
---|
27 |
|
---|
28 | if (decl.parent.some(function (i) {
|
---|
29 | return i.prop === '-ms-grid-row-align';
|
---|
30 | })) {
|
---|
31 | return undefined;
|
---|
32 | }
|
---|
33 |
|
---|
34 | var _utils$parse = utils.parse(decl),
|
---|
35 | _utils$parse$ = _utils$parse[0],
|
---|
36 | first = _utils$parse$[0],
|
---|
37 | second = _utils$parse$[1];
|
---|
38 |
|
---|
39 | if (second) {
|
---|
40 | utils.insertDecl(decl, 'grid-row-align', first);
|
---|
41 | utils.insertDecl(decl, 'grid-column-align', second);
|
---|
42 | } else {
|
---|
43 | utils.insertDecl(decl, 'grid-row-align', first);
|
---|
44 | utils.insertDecl(decl, 'grid-column-align', first);
|
---|
45 | }
|
---|
46 |
|
---|
47 | return undefined;
|
---|
48 | };
|
---|
49 |
|
---|
50 | return PlaceSelf;
|
---|
51 | }(Declaration);
|
---|
52 |
|
---|
53 | _defineProperty(PlaceSelf, "names", ['place-self']);
|
---|
54 |
|
---|
55 | module.exports = PlaceSelf; |
---|