Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

value.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. var vendor = require('postcss').vendor;
  5. var Prefixer = require('./prefixer');
  6. var OldValue = require('./old-value');
  7. var utils = require('./utils');
  8. var Value = /*#__PURE__*/function (_Prefixer) {
  9. _inheritsLoose(Value, _Prefixer);
  10. function Value() {
  11. return _Prefixer.apply(this, arguments) || this;
  12. }
  13. /**
  14. * Clone decl for each prefixed values
  15. */
  16. Value.save = function save(prefixes, decl) {
  17. var _this = this;
  18. var prop = decl.prop;
  19. var result = [];
  20. var _loop = function _loop(prefix) {
  21. var value = decl._autoprefixerValues[prefix];
  22. if (value === decl.value) {
  23. return "continue";
  24. }
  25. var item = void 0;
  26. var propPrefix = vendor.prefix(prop);
  27. if (propPrefix === '-pie-') {
  28. return "continue";
  29. }
  30. if (propPrefix === prefix) {
  31. item = decl.value = value;
  32. result.push(item);
  33. return "continue";
  34. }
  35. var prefixed = prefixes.prefixed(prop, prefix);
  36. var rule = decl.parent;
  37. if (!rule.every(function (i) {
  38. return i.prop !== prefixed;
  39. })) {
  40. result.push(item);
  41. return "continue";
  42. }
  43. var trimmed = value.replace(/\s+/, ' ');
  44. var already = rule.some(function (i) {
  45. return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
  46. });
  47. if (already) {
  48. result.push(item);
  49. return "continue";
  50. }
  51. var cloned = _this.clone(decl, {
  52. value: value
  53. });
  54. item = decl.parent.insertBefore(decl, cloned);
  55. result.push(item);
  56. };
  57. for (var prefix in decl._autoprefixerValues) {
  58. var _ret = _loop(prefix);
  59. if (_ret === "continue") continue;
  60. }
  61. return result;
  62. }
  63. /**
  64. * Is declaration need to be prefixed
  65. */
  66. ;
  67. var _proto = Value.prototype;
  68. _proto.check = function check(decl) {
  69. var value = decl.value;
  70. if (!value.includes(this.name)) {
  71. return false;
  72. }
  73. return !!value.match(this.regexp());
  74. }
  75. /**
  76. * Lazy regexp loading
  77. */
  78. ;
  79. _proto.regexp = function regexp() {
  80. return this.regexpCache || (this.regexpCache = utils.regexp(this.name));
  81. }
  82. /**
  83. * Add prefix to values in string
  84. */
  85. ;
  86. _proto.replace = function replace(string, prefix) {
  87. return string.replace(this.regexp(), "$1" + prefix + "$2");
  88. }
  89. /**
  90. * Get value with comments if it was not changed
  91. */
  92. ;
  93. _proto.value = function value(decl) {
  94. if (decl.raws.value && decl.raws.value.value === decl.value) {
  95. return decl.raws.value.raw;
  96. } else {
  97. return decl.value;
  98. }
  99. }
  100. /**
  101. * Save values with next prefixed token
  102. */
  103. ;
  104. _proto.add = function add(decl, prefix) {
  105. if (!decl._autoprefixerValues) {
  106. decl._autoprefixerValues = {};
  107. }
  108. var value = decl._autoprefixerValues[prefix] || this.value(decl);
  109. var before;
  110. do {
  111. before = value;
  112. value = this.replace(value, prefix);
  113. if (value === false) return;
  114. } while (value !== before);
  115. decl._autoprefixerValues[prefix] = value;
  116. }
  117. /**
  118. * Return function to fast find prefixed value
  119. */
  120. ;
  121. _proto.old = function old(prefix) {
  122. return new OldValue(this.name, prefix + this.name);
  123. };
  124. return Value;
  125. }(Prefixer);
  126. module.exports = Value;