[6a3a178] | 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 GridArea = /*#__PURE__*/function (_Declaration) {
|
---|
| 14 | _inheritsLoose(GridArea, _Declaration);
|
---|
| 15 |
|
---|
| 16 | function GridArea() {
|
---|
| 17 | return _Declaration.apply(this, arguments) || this;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | var _proto = GridArea.prototype;
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * Translate grid-area to separate -ms- prefixed properties
|
---|
| 24 | */
|
---|
| 25 | _proto.insert = function insert(decl, prefix, prefixes, result) {
|
---|
| 26 | if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
---|
| 27 | var values = utils.parse(decl);
|
---|
| 28 |
|
---|
| 29 | var _utils$translate = utils.translate(values, 0, 2),
|
---|
| 30 | rowStart = _utils$translate[0],
|
---|
| 31 | rowSpan = _utils$translate[1];
|
---|
| 32 |
|
---|
| 33 | var _utils$translate2 = utils.translate(values, 1, 3),
|
---|
| 34 | columnStart = _utils$translate2[0],
|
---|
| 35 | columnSpan = _utils$translate2[1];
|
---|
| 36 |
|
---|
| 37 | [['grid-row', rowStart], ['grid-row-span', rowSpan], ['grid-column', columnStart], ['grid-column-span', columnSpan]].forEach(function (_ref) {
|
---|
| 38 | var prop = _ref[0],
|
---|
| 39 | value = _ref[1];
|
---|
| 40 | utils.insertDecl(decl, prop, value);
|
---|
| 41 | });
|
---|
| 42 | utils.warnTemplateSelectorNotFound(decl, result);
|
---|
| 43 | utils.warnIfGridRowColumnExists(decl, result);
|
---|
| 44 | return undefined;
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | return GridArea;
|
---|
| 48 | }(Declaration);
|
---|
| 49 |
|
---|
| 50 | _defineProperty(GridArea, "names", ['grid-area']);
|
---|
| 51 |
|
---|
| 52 | module.exports = GridArea; |
---|