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.

49 lines
1.8 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 BlockLogical =
  7. /*#__PURE__*/
  8. function (_Declaration) {
  9. _inheritsLoose(BlockLogical, _Declaration);
  10. function BlockLogical() {
  11. return _Declaration.apply(this, arguments) || this;
  12. }
  13. var _proto = BlockLogical.prototype;
  14. /**
  15. * Use old syntax for -moz- and -webkit-
  16. */
  17. _proto.prefixed = function prefixed(prop, prefix) {
  18. if (prop.includes('-start')) {
  19. return prefix + prop.replace('-block-start', '-before');
  20. }
  21. return prefix + prop.replace('-block-end', '-after');
  22. }
  23. /**
  24. * Return property name by spec
  25. */
  26. ;
  27. _proto.normalize = function normalize(prop) {
  28. if (prop.includes('-before')) {
  29. return prop.replace('-before', '-block-start');
  30. }
  31. return prop.replace('-after', '-block-end');
  32. };
  33. return BlockLogical;
  34. }(Declaration);
  35. _defineProperty(BlockLogical, "names", ['border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', 'border-before', 'border-after', 'margin-before', 'margin-after', 'padding-before', 'padding-after']);
  36. module.exports = BlockLogical;