pubo-utils 1.0.129 → 1.0.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,42 +1,7 @@
1
- var __read = this && this.__read || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o),
5
- r,
6
- ar = [],
7
- e;
8
- try {
9
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
10
- } catch (error) {
11
- e = {
12
- error: error
13
- };
14
- } finally {
15
- try {
16
- if (r && !r.done && (m = i["return"])) m.call(i);
17
- } finally {
18
- if (e) throw e.error;
19
- }
20
- }
21
- return ar;
22
- };
23
- var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
24
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
- if (ar || !(i in from)) {
26
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
- ar[i] = from[i];
28
- }
29
- }
30
- return to.concat(ar || Array.prototype.slice.call(from));
31
- };
32
1
  export function throttle(cb, time) {
33
2
  var t;
34
3
  var onOff = true;
35
4
  return function () {
36
- var args = [];
37
- for (var _i = 0; _i < arguments.length; _i++) {
38
- args[_i] = arguments[_i];
39
- }
40
5
  if (!t) {
41
6
  t = setTimeout(function () {
42
7
  onOff = true;
@@ -45,7 +10,7 @@ export function throttle(cb, time) {
45
10
  }
46
11
  if (onOff) {
47
12
  onOff = false;
48
- cb.apply(void 0, __spreadArray([], __read(args), false));
13
+ cb.apply(void 0, arguments);
49
14
  }
50
15
  };
51
16
  }
@@ -1,16 +1,16 @@
1
- var ContinuousTrigger = /** @class */function () {
1
+ 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, _toPropertyKey(descriptor.key), descriptor); } }
2
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ export var ContinuousTrigger = /*#__PURE__*/function () {
2
6
  function ContinuousTrigger(props) {
7
+ this.timeout = void 0;
3
8
  this._count = 0;
9
+ this.props = void 0;
4
10
  this.props = props;
5
11
  }
6
- Object.defineProperty(ContinuousTrigger.prototype, "count", {
7
- get: function get() {
8
- return this._count;
9
- },
10
- enumerable: false,
11
- configurable: true
12
- });
13
- ContinuousTrigger.prototype.increment = function () {
12
+ var _proto = ContinuousTrigger.prototype;
13
+ _proto.increment = function increment() {
14
14
  var _this = this;
15
15
  clearTimeout(this.timeout);
16
16
  this.timeout = setTimeout(function () {
@@ -21,9 +21,14 @@ var ContinuousTrigger = /** @class */function () {
21
21
  this.props.cb();
22
22
  }
23
23
  };
24
- ContinuousTrigger.prototype.clear = function () {
24
+ _proto.clear = function clear() {
25
25
  this._count = 0;
26
26
  };
27
+ _createClass(ContinuousTrigger, [{
28
+ key: "count",
29
+ get: function get() {
30
+ return this._count;
31
+ }
32
+ }]);
27
33
  return ContinuousTrigger;
28
- }();
29
- export { ContinuousTrigger };
34
+ }();
@@ -1,28 +1,30 @@
1
- var WatchDog = /** @class */function () {
2
- function WatchDog(_a) {
3
- var _b = _a.limit,
4
- limit = _b === void 0 ? 10 : _b,
5
- onTimeout = _a.onTimeout;
1
+ export var WatchDog = /*#__PURE__*/function () {
2
+ function WatchDog(_ref) {
3
+ var _ref$limit = _ref.limit,
4
+ limit = _ref$limit === void 0 ? 10 : _ref$limit,
5
+ onTimeout = _ref.onTimeout;
6
6
  this.limit = 10;
7
+ this.onTimeout = void 0;
7
8
  this.timeout = null;
8
9
  this.limit = limit;
9
10
  this.onTimeout = onTimeout;
10
11
  }
11
- WatchDog.prototype.feed = function () {
12
+ var _proto = WatchDog.prototype;
13
+ _proto.feed = function feed() {
12
14
  this.init();
13
15
  };
14
- WatchDog.prototype.init = function () {
16
+ _proto.init = function init() {
15
17
  var _this = this;
16
18
  clearTimeout(this.timeout);
19
+ delete this.timeout;
17
20
  this.timeout = setTimeout(function () {
18
21
  return _this.onTimeout();
19
22
  }, this.limit * 1000);
20
23
  };
21
- WatchDog.prototype.stop = function () {
24
+ _proto.stop = function stop() {
22
25
  if (this.timeout) {
23
26
  clearTimeout(this.timeout);
24
27
  }
25
28
  };
26
29
  return WatchDog;
27
- }();
28
- export { WatchDog };
30
+ }();
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ 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, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
7
  Object.defineProperty(exports, "__esModule", {
4
8
  value: true
5
9
  });
@@ -27,8 +31,9 @@ var rgb2hex = function rgb2hex(color) {
27
31
  }).join('');
28
32
  };
29
33
  exports.rgb2hex = rgb2hex;
30
- var ColorUtils = /** @class */function () {
34
+ var ColorUtils = /*#__PURE__*/function () {
31
35
  function ColorUtils(n) {
36
+ this["int"] = void 0;
32
37
  if (typeof n === 'number') {
33
38
  this["int"] = n;
34
39
  } else if (typeof n === 'string') {
@@ -37,24 +42,11 @@ var ColorUtils = /** @class */function () {
37
42
  this["int"] = str2int((0, exports.rgb2hex)(n));
38
43
  }
39
44
  }
40
- ColorUtils.prototype.getRgbArray = function () {
45
+ var _proto = ColorUtils.prototype;
46
+ _proto.getRgbArray = function getRgbArray() {
41
47
  return (0, exports.hex2rgb)(this["int"]);
42
48
  };
43
- Object.defineProperty(ColorUtils.prototype, "rgb", {
44
- get: function get() {
45
- return "rba(".concat(this.getRgbArray().join(', '), ")");
46
- },
47
- enumerable: false,
48
- configurable: true
49
- });
50
- Object.defineProperty(ColorUtils.prototype, "hex", {
51
- get: function get() {
52
- return (0, exports.rgb2hex)(this.getRgbArray());
53
- },
54
- enumerable: false,
55
- configurable: true
56
- });
57
- ColorUtils.prototype.toString = function (type) {
49
+ _proto.toString = function toString(type) {
58
50
  if (type === void 0) {
59
51
  type = 'hex';
60
52
  }
@@ -63,6 +55,17 @@ var ColorUtils = /** @class */function () {
63
55
  }
64
56
  return this.hex;
65
57
  };
58
+ _createClass(ColorUtils, [{
59
+ key: "rgb",
60
+ get: function get() {
61
+ return "rba(" + this.getRgbArray().join(', ') + ")";
62
+ }
63
+ }, {
64
+ key: "hex",
65
+ get: function get() {
66
+ return (0, exports.rgb2hex)(this.getRgbArray());
67
+ }
68
+ }]);
66
69
  return ColorUtils;
67
70
  }();
68
71
  exports.ColorUtils = ColorUtils;
@@ -1,36 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var __read = this && this.__read || function (o, n) {
4
- var m = typeof Symbol === "function" && o[Symbol.iterator];
5
- if (!m) return o;
6
- var i = m.call(o),
7
- r,
8
- ar = [],
9
- e;
10
- try {
11
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
12
- } catch (error) {
13
- e = {
14
- error: error
15
- };
16
- } finally {
17
- try {
18
- if (r && !r.done && (m = i["return"])) m.call(i);
19
- } finally {
20
- if (e) throw e.error;
21
- }
22
- }
23
- return ar;
24
- };
25
- var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
26
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
- if (ar || !(i in from)) {
28
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
- ar[i] = from[i];
30
- }
31
- }
32
- return to.concat(ar || Array.prototype.slice.call(from));
33
- };
34
3
  Object.defineProperty(exports, "__esModule", {
35
4
  value: true
36
5
  });
@@ -40,36 +9,31 @@ var debounce = function debounce(cb, time, first) {
40
9
  first = false;
41
10
  }
42
11
  if (first) {
43
- var shouldRun_1 = true;
44
- var t_1;
12
+ var shouldRun = true;
13
+ var t;
45
14
  return function () {
46
- var args = [];
47
- for (var _i = 0; _i < arguments.length; _i++) {
48
- args[_i] = arguments[_i];
49
- }
50
- if (shouldRun_1) {
51
- cb.apply(void 0, __spreadArray([], __read(args), false));
52
- shouldRun_1 = false;
15
+ if (shouldRun) {
16
+ cb.apply(void 0, arguments);
17
+ shouldRun = false;
53
18
  }
54
- if (t_1) {
55
- clearTimeout(t_1);
19
+ if (t) {
20
+ clearTimeout(t);
56
21
  }
57
- t_1 = setTimeout(function () {
58
- return shouldRun_1 = true;
22
+ t = setTimeout(function () {
23
+ return shouldRun = true;
59
24
  }, time);
60
25
  };
61
26
  } else {
62
- var t_2;
27
+ var _t;
63
28
  return function () {
64
- var args = [];
65
- for (var _i = 0; _i < arguments.length; _i++) {
66
- args[_i] = arguments[_i];
29
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
+ args[_key] = arguments[_key];
67
31
  }
68
- if (t_2) {
69
- clearTimeout(t_2);
32
+ if (_t) {
33
+ clearTimeout(_t);
70
34
  }
71
- t_2 = setTimeout(function () {
72
- return cb.apply(void 0, __spreadArray([], __read(args), false));
35
+ _t = setTimeout(function () {
36
+ return cb.apply(void 0, args);
73
37
  }, time);
74
38
  };
75
39
  }