You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.0 KiB

4 years ago
  1. "use strict";
  2. 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; }
  3. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
  4. 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; }
  5. var Declaration = require('../declaration');
  6. var utils = require('./grid-utils');
  7. var PlaceSelf =
  8. /*#__PURE__*/
  9. function (_Declaration) {
  10. _inheritsLoose(PlaceSelf, _Declaration);
  11. function PlaceSelf() {
  12. return _Declaration.apply(this, arguments) || this;
  13. }
  14. var _proto = PlaceSelf.prototype;
  15. /**
  16. * Translate place-self to separate -ms- prefixed properties
  17. */
  18. _proto.insert = function insert(decl, prefix, prefixes) {
  19. if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes); // prevent doubling of prefixes
  20. if (decl.parent.some(function (i) {
  21. return i.prop === '-ms-grid-row-align';
  22. })) {
  23. return undefined;
  24. }
  25. var _utils$parse = utils.parse(decl),
  26. _utils$parse$ = _utils$parse[0],
  27. first = _utils$parse$[0],
  28. second = _utils$parse$[1];
  29. if (second) {
  30. utils.insertDecl(decl, 'grid-row-align', first);
  31. utils.insertDecl(decl, 'grid-column-align', second);
  32. } else {
  33. utils.insertDecl(decl, 'grid-row-align', first);
  34. utils.insertDecl(decl, 'grid-column-align', first);
  35. }
  36. return undefined;
  37. };
  38. return PlaceSelf;
  39. }(Declaration);
  40. _defineProperty(PlaceSelf, "names", ['place-self']);
  41. module.exports = PlaceSelf;