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.

mask-composite.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 MaskComposite = /*#__PURE__*/function (_Declaration) {
  7. _inheritsLoose(MaskComposite, _Declaration);
  8. function MaskComposite() {
  9. return _Declaration.apply(this, arguments) || this;
  10. }
  11. var _proto = MaskComposite.prototype;
  12. /**
  13. * Prefix mask-composite for webkit
  14. */
  15. _proto.insert = function insert(decl, prefix, prefixes) {
  16. var isCompositeProp = decl.prop === 'mask-composite';
  17. var compositeValues;
  18. if (isCompositeProp) {
  19. compositeValues = decl.value.split(',');
  20. } else {
  21. compositeValues = decl.value.match(MaskComposite.regexp) || [];
  22. }
  23. compositeValues = compositeValues.map(function (el) {
  24. return el.trim();
  25. }).filter(function (el) {
  26. return el;
  27. });
  28. var hasCompositeValues = compositeValues.length;
  29. var compositeDecl;
  30. if (hasCompositeValues) {
  31. compositeDecl = this.clone(decl);
  32. compositeDecl.value = compositeValues.map(function (value) {
  33. return MaskComposite.oldValues[value] || value;
  34. }).join(', ');
  35. if (compositeValues.includes('intersect')) {
  36. compositeDecl.value += ', xor';
  37. }
  38. compositeDecl.prop = prefix + 'mask-composite';
  39. }
  40. if (isCompositeProp) {
  41. if (!hasCompositeValues) {
  42. return undefined;
  43. }
  44. if (this.needCascade(decl)) {
  45. compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix);
  46. }
  47. return decl.parent.insertBefore(decl, compositeDecl);
  48. }
  49. var cloned = this.clone(decl);
  50. cloned.prop = prefix + cloned.prop;
  51. if (hasCompositeValues) {
  52. cloned.value = cloned.value.replace(MaskComposite.regexp, '');
  53. }
  54. if (this.needCascade(decl)) {
  55. cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
  56. }
  57. decl.parent.insertBefore(decl, cloned);
  58. if (!hasCompositeValues) {
  59. return decl;
  60. }
  61. if (this.needCascade(decl)) {
  62. compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix);
  63. }
  64. return decl.parent.insertBefore(decl, compositeDecl);
  65. };
  66. return MaskComposite;
  67. }(Declaration);
  68. _defineProperty(MaskComposite, "names", ['mask', 'mask-composite']);
  69. _defineProperty(MaskComposite, "oldValues", {
  70. add: 'source-over',
  71. substract: 'source-out',
  72. intersect: 'source-in',
  73. exclude: 'xor'
  74. });
  75. _defineProperty(MaskComposite, "regexp", new RegExp("\\s+(" + Object.keys(MaskComposite.oldValues).join('|') + ")\\b(?!\\))\\s*(?=[,])", 'ig'));
  76. module.exports = MaskComposite;