Bullet.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. "use strict";
  2. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  9. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  10. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  11. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  12. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  13. // Generated by CoffeeScript 2.5.1
  14. var Bullet, _Declaration;
  15. _Declaration = require('./_Declaration');
  16. module.exports = Bullet = function () {
  17. var self;
  18. var Bullet = /*#__PURE__*/function (_Declaration2) {
  19. _inherits(Bullet, _Declaration2);
  20. var _super = _createSuper(Bullet);
  21. function Bullet() {
  22. _classCallCheck(this, Bullet);
  23. return _super.apply(this, arguments);
  24. }
  25. _createClass(Bullet, [{
  26. key: "_set",
  27. value: function _set(val) {
  28. var alignment, bg, char, color, enabled, m, original;
  29. val = String(val);
  30. original = val;
  31. char = null;
  32. enabled = false;
  33. color = 'none';
  34. bg = 'none';
  35. if (m = val.match(/\"([^"]+)\"/) || (m = val.match(/\'([^']+)\'/))) {
  36. char = m[1];
  37. val = val.replace(m[0], '');
  38. enabled = true;
  39. }
  40. if (m = val.match(/(none|left|right|center)/)) {
  41. alignment = m[1];
  42. val = val.replace(m[0], '');
  43. } else {
  44. alignment = 'left';
  45. }
  46. if (alignment === 'none') {
  47. enabled = false;
  48. }
  49. if (m = val.match(/color\:([\w\-]+)/)) {
  50. color = m[1];
  51. val = val.replace(m[0], '');
  52. }
  53. if (m = val.match(/bg\:([\w\-]+)/)) {
  54. bg = m[1];
  55. val = val.replace(m[0], '');
  56. }
  57. if (val.trim() !== '') {
  58. throw Error("Unrecognizable value `".concat(original, "` for `").concat(this.prop, "`"));
  59. }
  60. return this.val = {
  61. enabled: enabled,
  62. char: char,
  63. alignment: alignment,
  64. background: bg,
  65. color: color
  66. };
  67. }
  68. }]);
  69. return Bullet;
  70. }(_Declaration);
  71. ;
  72. self = Bullet;
  73. return Bullet;
  74. }.call(void 0);