inline-logical.js 1.7 KB

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