@azrico/webobject 1.5.70 → 1.5.72

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.
Files changed (31) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/src/WebObjects/ParentWebObject.d.ts +24 -24
  3. package/dist/src/WebObjects/ParentWebObject.js +7 -7
  4. package/dist/src/WebObjects/WebObject.d.ts +153 -153
  5. package/dist/src/WebObjects/WebObject.js +476 -561
  6. package/dist/src/WebObjects/WebObjectHelper.d.ts +9 -9
  7. package/dist/src/WebObjects/WebObjectHelper.js +4 -4
  8. package/dist/src/WebObjects/WebObjectHelper.test.d.ts +1 -1
  9. package/dist/src/WebObjects/WebObjectHelper.test.js +1 -1
  10. package/dist/src/WebObjects/WebObjectManager.d.ts +68 -68
  11. package/dist/src/WebObjects/WebObjectManager.js +305 -351
  12. package/dist/src/WebObjects/WebObjectPathHelper.d.ts +36 -36
  13. package/dist/src/WebObjects/WebObjectPathHelper.js +31 -39
  14. package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +1 -1
  15. package/dist/src/WebObjects/WebObjectPathHelper.test.js +55 -61
  16. package/dist/src/index.d.ts +10 -10
  17. package/dist/src/structs/DummyObject.d.ts +5 -5
  18. package/dist/src/structs/DummyObject.js +1 -1
  19. package/dist/src/structs/MapableObject.d.ts +43 -43
  20. package/dist/src/structs/MapableObject.js +3 -3
  21. package/dist/src/structs/MetaObject.d.ts +15 -15
  22. package/dist/src/structs/MetaObject.js +19 -25
  23. package/dist/src/structs/ObjectArray.d.ts +10 -10
  24. package/dist/src/structs/ObjectArray.js +1 -1
  25. package/dist/src/structs/ObjectManager.d.ts +140 -140
  26. package/dist/src/structs/ObjectManager.js +206 -226
  27. package/dist/src/structs/ObjectWithTemp.d.ts +17 -17
  28. package/dist/src/structs/ObjectWithTemp.js +13 -17
  29. package/dist/src/structs/SimpleObject.d.ts +318 -303
  30. package/dist/src/structs/SimpleObject.js +423 -467
  31. package/package.json +63 -82
@@ -12,9 +12,11 @@ var _object = require("@azrico/object");
12
12
  var _MapableObject2 = _interopRequireDefault(require("./MapableObject"));
13
13
  var _useGetter = _interopRequireDefault(require("@azrico/event/dist/src/hooks/useGetter"));
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
15
+ var cache;
16
+ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, "default": e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
16
17
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
17
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
18
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
19
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
18
20
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
19
21
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
20
22
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -32,15 +34,16 @@ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new T
32
34
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
33
35
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
34
36
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
35
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
36
- /**
37
- * This class manages the events of an Simple Object
37
+ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
38
+ /**
39
+ * This class manages the events of an Simple Object
38
40
  */
39
41
  var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObject) {
40
42
  function ObjectManager(defaultObject) {
41
43
  var _this;
42
44
  _classCallCheck(this, ObjectManager);
43
45
  _this = _callSuper(this, ObjectManager);
46
+ //a manager is usually made before its object is loaded, that is not a null set
44
47
  _defineProperty(_this, "__eventContext", {});
45
48
  _defineProperty(_this, "__last_object_data", {});
46
49
  _defineProperty(_this, "__currentObject", void 0);
@@ -48,34 +51,31 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
48
51
  //can the current object be set to null safely?
49
52
  _defineProperty(_this, "__object_nullable", false);
50
53
  _defineProperty(_this, "setTemp", _this.set_temp);
51
- _this.setObject(defaultObject);
54
+ if (defaultObject !== undefined) _this.setObject(defaultObject);
52
55
  return _this;
53
56
  }
54
57
  _inherits(ObjectManager, _MapableObject);
55
58
  return _createClass(ObjectManager, [{
56
59
  key: "notifyChanged",
57
60
  value: function () {
58
- var _notifyChanged = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(type, key, value, subvalue) {
61
+ var _notifyChanged = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(type, key, value, subvalue) {
59
62
  var obj, typestr;
60
- return _regeneratorRuntime().wrap(function _callee$(_context) {
61
- while (1) switch (_context.prev = _context.next) {
63
+ return _regenerator().w(function (_context) {
64
+ while (1) switch (_context.n) {
62
65
  case 0:
63
66
  obj = this.getObject();
64
67
  if (obj) {
65
- _context.next = 3;
68
+ _context.n = 1;
66
69
  break;
67
70
  }
68
- return _context.abrupt("return", false);
69
- case 3:
71
+ return _context.a(2, false);
72
+ case 1:
70
73
  if (value === undefined && type != "meta") value = obj.get(key);
71
74
  typestr = (type ? "$".concat(type, "$") : "") + String(key);
72
- _context.next = 7;
75
+ _context.n = 2;
73
76
  return this.event_run("on_change", typestr, value);
74
- case 7:
75
- return _context.abrupt("return", _context.sent);
76
- case 8:
77
- case "end":
78
- return _context.stop();
77
+ case 2:
78
+ return _context.a(2, _context.v);
79
79
  }
80
80
  }, _callee, this);
81
81
  }));
@@ -85,9 +85,9 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
85
85
  return notifyChanged;
86
86
  }()
87
87
  /* -------------------------------------------------------------------------- */
88
- /**
89
- * Get the object this manager is managing
90
- * @returns the object
88
+ /**
89
+ * Get the object this manager is managing
90
+ * @returns the object
91
91
  */
92
92
  }, {
93
93
  key: "obj",
@@ -95,9 +95,9 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
95
95
  var _this$__currentObject;
96
96
  return (_this$__currentObject = this.__currentObject) !== null && _this$__currentObject !== void 0 ? _this$__currentObject : undefined;
97
97
  }
98
- /**
99
- * Get the object this manager is managing
100
- * @returns the object
98
+ /**
99
+ * Get the object this manager is managing
100
+ * @returns the object
101
101
  */
102
102
  }, {
103
103
  key: "getObject",
@@ -105,10 +105,10 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
105
105
  var _this$__currentObject2;
106
106
  return (_this$__currentObject2 = this.__currentObject) !== null && _this$__currentObject2 !== void 0 ? _this$__currentObject2 : undefined;
107
107
  }
108
- /**
109
- * Set the object this manager is managing
110
- * @param toObj
111
- * @returns
108
+ /**
109
+ * Set the object this manager is managing
110
+ * @param toObj
111
+ * @returns
112
112
  */
113
113
  }, {
114
114
  key: "setObject",
@@ -158,8 +158,8 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
158
158
  }, {
159
159
  key: "canModify",
160
160
  get: function get() {
161
- var _this$obj2;
162
- return !((_this$obj2 = this.obj) !== null && _this$obj2 !== void 0 && _this$obj2.canModify);
161
+ var _this$obj$canModify, _this$obj2;
162
+ return (_this$obj$canModify = (_this$obj2 = this.obj) === null || _this$obj2 === void 0 ? void 0 : _this$obj2.canModify) !== null && _this$obj$canModify !== void 0 ? _this$obj$canModify : false;
163
163
  }
164
164
  }, {
165
165
  key: "isNew",
@@ -207,51 +207,48 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
207
207
  }
208
208
  return thisobj.get(key, original);
209
209
  }
210
- /**
211
- * use a property from the object, this will return latest value of the property
212
- * uses `EventManager` to detect changes
210
+ /**
211
+ * use a property from the object, this will return latest value of the property
212
+ * uses `EventManager` to detect changes
213
213
  */
214
214
  }, {
215
215
  key: "use",
216
216
  value: function use(key) {
217
217
  return (0, _event.useProperty)(this, key);
218
218
  }
219
- /**
220
- * set value
221
- * @param key
222
- * @param value
223
- * @return true if changed , false otherwise
219
+ /**
220
+ * set value
221
+ * @param key
222
+ * @param value
223
+ * @return true if changed , false otherwise
224
224
  */
225
225
  }, {
226
226
  key: "set",
227
227
  value: (function () {
228
- var _set = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
229
- var thisobj;
230
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
231
- while (1) switch (_context2.prev = _context2.next) {
228
+ var _set = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(key, value) {
229
+ var thisobj, _t;
230
+ return _regenerator().w(function (_context2) {
231
+ while (1) switch (_context2.n) {
232
232
  case 0:
233
233
  thisobj = this.obj;
234
234
  if (!(thisobj == null || typeof thisobj.set != "function")) {
235
- _context2.next = 4;
235
+ _context2.n = 1;
236
236
  break;
237
237
  }
238
238
  if (!this.__object_nullable) console.error("cant use set when object is not defined. maybe you have to use New() ?");
239
- return _context2.abrupt("return", false);
240
- case 4:
241
- _context2.next = 6;
239
+ return _context2.a(2, false);
240
+ case 1:
241
+ _context2.n = 2;
242
242
  return thisobj.set(key, value);
243
- case 6:
244
- _context2.t0 = _context2.sent;
245
- if (_context2.t0) {
246
- _context2.next = 9;
243
+ case 2:
244
+ _t = _context2.v;
245
+ if (_t) {
246
+ _context2.n = 3;
247
247
  break;
248
248
  }
249
- _context2.t0 = false;
250
- case 9:
251
- return _context2.abrupt("return", _context2.t0);
252
- case 10:
253
- case "end":
254
- return _context2.stop();
249
+ _t = false;
250
+ case 3:
251
+ return _context2.a(2, _t);
255
252
  }
256
253
  }, _callee2, this);
257
254
  }));
@@ -260,47 +257,45 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
260
257
  }
261
258
  return set;
262
259
  }()
263
- /**
264
- * set key of subObject
265
- * @param key
266
- * @param value
267
- * @param subvalue
268
- * @return true if changed , false otherwise
260
+ /**
261
+ * set key of subObject
262
+ * @param key
263
+ * @param value
264
+ * @param subvalue
265
+ * @return true if changed , false otherwise
269
266
  */
270
267
  )
271
268
  }, {
272
269
  key: "setSubValue",
273
270
  value: (function () {
274
- var _setSubValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, objKey, subvalue) {
271
+ var _setSubValue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key, objKey, subvalue) {
275
272
  var _yield$this$obj$setSu, _this$obj8;
276
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
277
- while (1) switch (_context3.prev = _context3.next) {
273
+ var _t2, _t3, _t4;
274
+ return _regenerator().w(function (_context3) {
275
+ while (1) switch (_context3.n) {
278
276
  case 0:
279
- _context3.next = 2;
277
+ _context3.n = 1;
280
278
  return (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setSubValue(key, objKey, subvalue);
281
- case 2:
282
- _context3.t1 = _yield$this$obj$setSu = _context3.sent;
283
- _context3.t0 = _context3.t1 !== null;
284
- if (!_context3.t0) {
285
- _context3.next = 6;
279
+ case 1:
280
+ _t3 = _yield$this$obj$setSu = _context3.v;
281
+ _t2 = _t3 !== null;
282
+ if (!_t2) {
283
+ _context3.n = 2;
286
284
  break;
287
285
  }
288
- _context3.t0 = _yield$this$obj$setSu !== void 0;
289
- case 6:
290
- if (!_context3.t0) {
291
- _context3.next = 10;
286
+ _t2 = _yield$this$obj$setSu !== void 0;
287
+ case 2:
288
+ if (!_t2) {
289
+ _context3.n = 3;
292
290
  break;
293
291
  }
294
- _context3.t2 = _yield$this$obj$setSu;
295
- _context3.next = 11;
292
+ _t4 = _yield$this$obj$setSu;
293
+ _context3.n = 4;
296
294
  break;
297
- case 10:
298
- _context3.t2 = false;
299
- case 11:
300
- return _context3.abrupt("return", _context3.t2);
301
- case 12:
302
- case "end":
303
- return _context3.stop();
295
+ case 3:
296
+ _t4 = false;
297
+ case 4:
298
+ return _context3.a(2, _t4);
304
299
  }
305
300
  }, _callee3, this);
306
301
  }));
@@ -313,36 +308,34 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
313
308
  }, {
314
309
  key: "pushValue",
315
310
  value: function () {
316
- var _pushValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, value) {
311
+ var _pushValue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(key, value) {
317
312
  var _yield$this$obj$pushV, _this$obj9;
318
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
319
- while (1) switch (_context4.prev = _context4.next) {
313
+ var _t5, _t6, _t7;
314
+ return _regenerator().w(function (_context4) {
315
+ while (1) switch (_context4.n) {
320
316
  case 0:
321
- _context4.next = 2;
317
+ _context4.n = 1;
322
318
  return (_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.pushValue(key, value);
323
- case 2:
324
- _context4.t1 = _yield$this$obj$pushV = _context4.sent;
325
- _context4.t0 = _context4.t1 !== null;
326
- if (!_context4.t0) {
327
- _context4.next = 6;
319
+ case 1:
320
+ _t6 = _yield$this$obj$pushV = _context4.v;
321
+ _t5 = _t6 !== null;
322
+ if (!_t5) {
323
+ _context4.n = 2;
328
324
  break;
329
325
  }
330
- _context4.t0 = _yield$this$obj$pushV !== void 0;
331
- case 6:
332
- if (!_context4.t0) {
333
- _context4.next = 10;
326
+ _t5 = _yield$this$obj$pushV !== void 0;
327
+ case 2:
328
+ if (!_t5) {
329
+ _context4.n = 3;
334
330
  break;
335
331
  }
336
- _context4.t2 = _yield$this$obj$pushV;
337
- _context4.next = 11;
332
+ _t7 = _yield$this$obj$pushV;
333
+ _context4.n = 4;
338
334
  break;
339
- case 10:
340
- _context4.t2 = false;
341
- case 11:
342
- return _context4.abrupt("return", _context4.t2);
343
- case 12:
344
- case "end":
345
- return _context4.stop();
335
+ case 3:
336
+ _t7 = false;
337
+ case 4:
338
+ return _context4.a(2, _t7);
346
339
  }
347
340
  }, _callee4, this);
348
341
  }));
@@ -354,23 +347,20 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
354
347
  }, {
355
348
  key: "set_temp",
356
349
  value: function () {
357
- var _set_temp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
350
+ var _set_temp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(key, value) {
358
351
  var sendChanges,
359
352
  _args5 = arguments;
360
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
361
- while (1) switch (_context5.prev = _context5.next) {
353
+ return _regenerator().w(function (_context5) {
354
+ while (1) switch (_context5.n) {
362
355
  case 0:
363
356
  sendChanges = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : false;
364
- _context5.next = 3;
357
+ _context5.n = 1;
365
358
  return this.setObjectTemp(key, value, sendChanges);
366
- case 3:
367
- _context5.next = 5;
359
+ case 1:
360
+ _context5.n = 2;
368
361
  return _superPropGet(ObjectManager, "set_temp", this, 3)([key, value]);
369
- case 5:
370
- return _context5.abrupt("return", _context5.sent);
371
- case 6:
372
- case "end":
373
- return _context5.stop();
362
+ case 2:
363
+ return _context5.a(2, _context5.v);
374
364
  }
375
365
  }, _callee5, this);
376
366
  }));
@@ -383,39 +373,39 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
383
373
  key: "setObjectTemp",
384
374
  value: //set temp value of object
385
375
  function () {
386
- var _setObjectTemp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, value) {
376
+ var _setObjectTemp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(key, value) {
387
377
  var _yield$this$obj$set_t, _this$obj0;
388
378
  var sendChanges,
389
- _args6 = arguments;
390
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
391
- while (1) switch (_context6.prev = _context6.next) {
379
+ _args6 = arguments,
380
+ _t8,
381
+ _t9,
382
+ _t0;
383
+ return _regenerator().w(function (_context6) {
384
+ while (1) switch (_context6.n) {
392
385
  case 0:
393
386
  sendChanges = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : false;
394
- _context6.next = 3;
387
+ _context6.n = 1;
395
388
  return (_this$obj0 = this.obj) === null || _this$obj0 === void 0 ? void 0 : _this$obj0.set_temp(key, value, sendChanges);
396
- case 3:
397
- _context6.t1 = _yield$this$obj$set_t = _context6.sent;
398
- _context6.t0 = _context6.t1 !== null;
399
- if (!_context6.t0) {
400
- _context6.next = 7;
389
+ case 1:
390
+ _t9 = _yield$this$obj$set_t = _context6.v;
391
+ _t8 = _t9 !== null;
392
+ if (!_t8) {
393
+ _context6.n = 2;
401
394
  break;
402
395
  }
403
- _context6.t0 = _yield$this$obj$set_t !== void 0;
404
- case 7:
405
- if (!_context6.t0) {
406
- _context6.next = 11;
396
+ _t8 = _yield$this$obj$set_t !== void 0;
397
+ case 2:
398
+ if (!_t8) {
399
+ _context6.n = 3;
407
400
  break;
408
401
  }
409
- _context6.t2 = _yield$this$obj$set_t;
410
- _context6.next = 12;
402
+ _t0 = _yield$this$obj$set_t;
403
+ _context6.n = 4;
411
404
  break;
412
- case 11:
413
- _context6.t2 = false;
414
- case 12:
415
- return _context6.abrupt("return", _context6.t2);
416
- case 13:
417
- case "end":
418
- return _context6.stop();
405
+ case 3:
406
+ _t0 = false;
407
+ case 4:
408
+ return _context6.a(2, _t0);
419
409
  }
420
410
  }, _callee6, this);
421
411
  }));
@@ -455,24 +445,21 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
455
445
  }, {
456
446
  key: "event_run",
457
447
  value: (function () {
458
- var _event_run = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventName) {
448
+ var _event_run = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(eventName) {
459
449
  var _len,
460
450
  params,
461
451
  _key,
462
452
  _args7 = arguments;
463
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
464
- while (1) switch (_context7.prev = _context7.next) {
453
+ return _regenerator().w(function (_context7) {
454
+ while (1) switch (_context7.n) {
465
455
  case 0:
466
456
  for (_len = _args7.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
467
457
  params[_key - 1] = _args7[_key];
468
458
  }
469
- _context7.next = 3;
459
+ _context7.n = 1;
470
460
  return _event["default"].run.apply(_event["default"], [this, eventName].concat(params));
471
- case 3:
472
- return _context7.abrupt("return", _context7.sent);
473
- case 4:
474
- case "end":
475
- return _context7.stop();
461
+ case 1:
462
+ return _context7.a(2, _context7.v);
476
463
  }
477
464
  }, _callee7, this);
478
465
  }));
@@ -488,12 +475,12 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
488
475
  var runOnce = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
489
476
  return (0, _event.useEvent)(this, name, runEvent, onlyOn, runOnce);
490
477
  }
491
- /**
492
- * only useful for getter functions that dont rely on states
493
- * @param name
494
- * @param runEvent
495
- * @param onlyOn
496
- * @returns
478
+ /**
479
+ * only useful for getter functions that dont rely on states
480
+ * @param name
481
+ * @param runEvent
482
+ * @param onlyOn
483
+ * @returns
497
484
  */
498
485
  }, {
499
486
  key: "event_use_getter",
@@ -509,16 +496,16 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
509
496
  }, {
510
497
  key: "event_add",
511
498
  value: function () {
512
- var _event_add = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(eventName, uniqueName, eventFunction) {
499
+ var _event_add = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(eventName, uniqueName, eventFunction) {
513
500
  var eventChecker,
514
501
  runOnRegister,
515
502
  _args8 = arguments;
516
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
517
- while (1) switch (_context8.prev = _context8.next) {
503
+ return _regenerator().w(function (_context8) {
504
+ while (1) switch (_context8.n) {
518
505
  case 0:
519
506
  eventChecker = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : null;
520
507
  runOnRegister = _args8.length > 4 && _args8[4] !== undefined ? _args8[4] : false;
521
- _context8.next = 4;
508
+ _context8.n = 1;
522
509
  return _event.EventManager.add(this, {
523
510
  eventName: eventName,
524
511
  uniqueName: uniqueName,
@@ -526,9 +513,8 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
526
513
  eventChecker: eventChecker,
527
514
  runOnRegister: runOnRegister
528
515
  });
529
- case 4:
530
- case "end":
531
- return _context8.stop();
516
+ case 1:
517
+ return _context8.a(2);
532
518
  }
533
519
  }, _callee8, this);
534
520
  }));
@@ -570,34 +556,33 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
570
556
  /* -------------------------------------------------------------------------- */
571
557
  /* Options */
572
558
  /* -------------------------------------------------------------------------- */
573
- /**
574
- * Set an option to some value, if its already equal to the value it will be deleted instead
575
- * @param key
576
- * @param value
577
- * @returns
559
+ /**
560
+ * Set an option to some value, if its already equal to the value it will be deleted instead
561
+ * @param key
562
+ * @param value
563
+ * @returns
578
564
  */
579
565
  function () {
580
- var _toggleOption = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
566
+ var _toggleOption = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(key, value) {
581
567
  var oldval;
582
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
583
- while (1) switch (_context9.prev = _context9.next) {
568
+ return _regenerator().w(function (_context9) {
569
+ while (1) switch (_context9.n) {
584
570
  case 0:
585
571
  oldval = this.getOption(key);
586
572
  if (!(0, _object.object_equals_loose)(oldval, value)) {
587
- _context9.next = 6;
573
+ _context9.n = 2;
588
574
  break;
589
575
  }
590
- _context9.next = 4;
576
+ _context9.n = 1;
591
577
  return this.setOption(key, null);
592
- case 4:
593
- _context9.next = 8;
578
+ case 1:
579
+ _context9.n = 3;
594
580
  break;
595
- case 6:
596
- _context9.next = 8;
581
+ case 2:
582
+ _context9.n = 3;
597
583
  return this.setOption(key, value);
598
- case 8:
599
- case "end":
600
- return _context9.stop();
584
+ case 3:
585
+ return _context9.a(2);
601
586
  }
602
587
  }, _callee9, this);
603
588
  }));
@@ -613,19 +598,19 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
613
598
  key = key.toLowerCase();
614
599
  return this.__options[key];
615
600
  }
616
- /**
617
- * updates `__options` and runs the `event_run`
618
- * @param key
619
- * @param value
620
- * @returns true if changed, false otherwise
601
+ /**
602
+ * updates `__options` and runs the `event_run`
603
+ * @param key
604
+ * @param value
605
+ * @returns true if changed, false otherwise
621
606
  */
622
607
  }, {
623
608
  key: "setOption",
624
609
  value: (function () {
625
- var _setOption = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(key, value) {
610
+ var _setOption = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(key, value) {
626
611
  var isChanged;
627
- return _regeneratorRuntime().wrap(function _callee0$(_context0) {
628
- while (1) switch (_context0.prev = _context0.next) {
612
+ return _regenerator().w(function (_context0) {
613
+ while (1) switch (_context0.n) {
629
614
  case 0:
630
615
  if (this.__options == null) this.__options = {};
631
616
  key = key.toLowerCase();
@@ -635,13 +620,10 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
635
620
  } else {
636
621
  this.__options[key] = value;
637
622
  }
638
- _context0.next = 6;
623
+ _context0.n = 1;
639
624
  return this.event_run("on_option_change", key, value);
640
- case 6:
641
- return _context0.abrupt("return", isChanged);
642
- case 7:
643
- case "end":
644
- return _context0.stop();
625
+ case 1:
626
+ return _context0.a(2, isChanged);
645
627
  }
646
628
  }, _callee0, this);
647
629
  }));
@@ -650,10 +632,10 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
650
632
  }
651
633
  return setOption;
652
634
  }()
653
- /**
654
- * use an option and detect its changes in real time. similar to React state
655
- * @param key name of the option
656
- * @returns value of the option
635
+ /**
636
+ * use an option and detect its changes in real time. similar to React state
637
+ * @param key name of the option
638
+ * @returns value of the option
657
639
  */
658
640
  )
659
641
  }, {
@@ -664,38 +646,37 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
664
646
  return _this3.getOption(key);
665
647
  }, [key]);
666
648
  }
667
- /**
668
- * Sets an option then does an action,
669
- * after the action is run, updates the option again
670
- * @param key
671
- * @param value
672
- * @param nextvalue
673
- * @param action
649
+ /**
650
+ * Sets an option then does an action,
651
+ * after the action is run, updates the option again
652
+ * @param key
653
+ * @param value
654
+ * @param nextvalue
655
+ * @param action
674
656
  */
675
657
  }, {
676
658
  key: "holdOption",
677
659
  value: (function () {
678
- var _holdOption = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(key, value, nextvalue, action) {
679
- return _regeneratorRuntime().wrap(function _callee1$(_context1) {
680
- while (1) switch (_context1.prev = _context1.next) {
660
+ var _holdOption = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(key, value, nextvalue, action) {
661
+ return _regenerator().w(function (_context1) {
662
+ while (1) switch (_context1.p = _context1.n) {
681
663
  case 0:
682
- _context1.prev = 0;
664
+ _context1.p = 0;
683
665
  this.setOption(key, value);
684
666
  if (!(typeof action === "function")) {
685
- _context1.next = 5;
667
+ _context1.n = 1;
686
668
  break;
687
669
  }
688
- _context1.next = 5;
670
+ _context1.n = 1;
689
671
  return action();
690
- case 5:
691
- _context1.prev = 5;
672
+ case 1:
673
+ _context1.p = 1;
692
674
  this.setOption(key, nextvalue);
693
- return _context1.finish(5);
694
- case 8:
695
- case "end":
696
- return _context1.stop();
675
+ return _context1.f(1);
676
+ case 2:
677
+ return _context1.a(2);
697
678
  }
698
- }, _callee1, this, [[0,, 5, 8]]);
679
+ }, _callee1, this, [[0,, 1, 2]]);
699
680
  }));
700
681
  function holdOption(_x22, _x23, _x24, _x25) {
701
682
  return _holdOption.apply(this, arguments);
@@ -703,8 +684,8 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
703
684
  return holdOption;
704
685
  }()
705
686
  /* ------------------------------ useIsChanged; ----------------------------- */
706
- /**
707
- * @returns isChanged
687
+ /**
688
+ * @returns isChanged
708
689
  */
709
690
  )
710
691
  }, {
@@ -715,15 +696,14 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObjec
715
696
  }, {
716
697
  key: "checkIsChanged",
717
698
  value: function () {
718
- var _checkIsChanged = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
719
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
720
- while (1) switch (_context10.prev = _context10.next) {
699
+ var _checkIsChanged = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
700
+ return _regenerator().w(function (_context10) {
701
+ while (1) switch (_context10.n) {
721
702
  case 0:
722
- _context10.next = 2;
703
+ _context10.n = 1;
723
704
  return this.setOption("ischanged", this.isChanged);
724
- case 2:
725
- case "end":
726
- return _context10.stop();
705
+ case 1:
706
+ return _context10.a(2);
727
707
  }
728
708
  }, _callee10, this);
729
709
  }));