@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.
- package/dist/index.d.ts +1 -1
- package/dist/src/WebObjects/ParentWebObject.d.ts +24 -24
- package/dist/src/WebObjects/ParentWebObject.js +7 -7
- package/dist/src/WebObjects/WebObject.d.ts +153 -153
- package/dist/src/WebObjects/WebObject.js +476 -561
- package/dist/src/WebObjects/WebObjectHelper.d.ts +9 -9
- package/dist/src/WebObjects/WebObjectHelper.js +4 -4
- package/dist/src/WebObjects/WebObjectHelper.test.d.ts +1 -1
- package/dist/src/WebObjects/WebObjectHelper.test.js +1 -1
- package/dist/src/WebObjects/WebObjectManager.d.ts +68 -68
- package/dist/src/WebObjects/WebObjectManager.js +305 -351
- package/dist/src/WebObjects/WebObjectPathHelper.d.ts +36 -36
- package/dist/src/WebObjects/WebObjectPathHelper.js +31 -39
- package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +1 -1
- package/dist/src/WebObjects/WebObjectPathHelper.test.js +55 -61
- package/dist/src/index.d.ts +10 -10
- package/dist/src/structs/DummyObject.d.ts +5 -5
- package/dist/src/structs/DummyObject.js +1 -1
- package/dist/src/structs/MapableObject.d.ts +43 -43
- package/dist/src/structs/MapableObject.js +3 -3
- package/dist/src/structs/MetaObject.d.ts +15 -15
- package/dist/src/structs/MetaObject.js +19 -25
- package/dist/src/structs/ObjectArray.d.ts +10 -10
- package/dist/src/structs/ObjectArray.js +1 -1
- package/dist/src/structs/ObjectManager.d.ts +140 -140
- package/dist/src/structs/ObjectManager.js +206 -226
- package/dist/src/structs/ObjectWithTemp.d.ts +17 -17
- package/dist/src/structs/ObjectWithTemp.js +13 -17
- package/dist/src/structs/SimpleObject.d.ts +318 -303
- package/dist/src/structs/SimpleObject.js +423 -467
- 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
|
-
|
|
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
|
|
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,
|
|
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__*/
|
|
61
|
+
var _notifyChanged = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(type, key, value, subvalue) {
|
|
59
62
|
var obj, typestr;
|
|
60
|
-
return
|
|
61
|
-
while (1) switch (_context.
|
|
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.
|
|
68
|
+
_context.n = 1;
|
|
66
69
|
break;
|
|
67
70
|
}
|
|
68
|
-
return _context.
|
|
69
|
-
case
|
|
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.
|
|
75
|
+
_context.n = 2;
|
|
73
76
|
return this.event_run("on_change", typestr, value);
|
|
74
|
-
case
|
|
75
|
-
return _context.
|
|
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
|
|
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__*/
|
|
229
|
-
var thisobj;
|
|
230
|
-
return
|
|
231
|
-
while (1) switch (_context2.
|
|
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.
|
|
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.
|
|
240
|
-
case
|
|
241
|
-
_context2.
|
|
239
|
+
return _context2.a(2, false);
|
|
240
|
+
case 1:
|
|
241
|
+
_context2.n = 2;
|
|
242
242
|
return thisobj.set(key, value);
|
|
243
|
-
case
|
|
244
|
-
|
|
245
|
-
if (
|
|
246
|
-
_context2.
|
|
243
|
+
case 2:
|
|
244
|
+
_t = _context2.v;
|
|
245
|
+
if (_t) {
|
|
246
|
+
_context2.n = 3;
|
|
247
247
|
break;
|
|
248
248
|
}
|
|
249
|
-
|
|
250
|
-
case
|
|
251
|
-
return _context2.
|
|
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__*/
|
|
271
|
+
var _setSubValue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key, objKey, subvalue) {
|
|
275
272
|
var _yield$this$obj$setSu, _this$obj8;
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
var _t2, _t3, _t4;
|
|
274
|
+
return _regenerator().w(function (_context3) {
|
|
275
|
+
while (1) switch (_context3.n) {
|
|
278
276
|
case 0:
|
|
279
|
-
_context3.
|
|
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
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (!
|
|
285
|
-
_context3.
|
|
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
|
-
|
|
289
|
-
case
|
|
290
|
-
if (!
|
|
291
|
-
_context3.
|
|
286
|
+
_t2 = _yield$this$obj$setSu !== void 0;
|
|
287
|
+
case 2:
|
|
288
|
+
if (!_t2) {
|
|
289
|
+
_context3.n = 3;
|
|
292
290
|
break;
|
|
293
291
|
}
|
|
294
|
-
|
|
295
|
-
_context3.
|
|
292
|
+
_t4 = _yield$this$obj$setSu;
|
|
293
|
+
_context3.n = 4;
|
|
296
294
|
break;
|
|
297
|
-
case
|
|
298
|
-
|
|
299
|
-
case
|
|
300
|
-
return _context3.
|
|
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__*/
|
|
311
|
+
var _pushValue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(key, value) {
|
|
317
312
|
var _yield$this$obj$pushV, _this$obj9;
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
var _t5, _t6, _t7;
|
|
314
|
+
return _regenerator().w(function (_context4) {
|
|
315
|
+
while (1) switch (_context4.n) {
|
|
320
316
|
case 0:
|
|
321
|
-
_context4.
|
|
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
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (!
|
|
327
|
-
_context4.
|
|
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
|
-
|
|
331
|
-
case
|
|
332
|
-
if (!
|
|
333
|
-
_context4.
|
|
326
|
+
_t5 = _yield$this$obj$pushV !== void 0;
|
|
327
|
+
case 2:
|
|
328
|
+
if (!_t5) {
|
|
329
|
+
_context4.n = 3;
|
|
334
330
|
break;
|
|
335
331
|
}
|
|
336
|
-
|
|
337
|
-
_context4.
|
|
332
|
+
_t7 = _yield$this$obj$pushV;
|
|
333
|
+
_context4.n = 4;
|
|
338
334
|
break;
|
|
339
|
-
case
|
|
340
|
-
|
|
341
|
-
case
|
|
342
|
-
return _context4.
|
|
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__*/
|
|
350
|
+
var _set_temp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(key, value) {
|
|
358
351
|
var sendChanges,
|
|
359
352
|
_args5 = arguments;
|
|
360
|
-
return
|
|
361
|
-
while (1) switch (_context5.
|
|
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.
|
|
357
|
+
_context5.n = 1;
|
|
365
358
|
return this.setObjectTemp(key, value, sendChanges);
|
|
366
|
-
case
|
|
367
|
-
_context5.
|
|
359
|
+
case 1:
|
|
360
|
+
_context5.n = 2;
|
|
368
361
|
return _superPropGet(ObjectManager, "set_temp", this, 3)([key, value]);
|
|
369
|
-
case
|
|
370
|
-
return _context5.
|
|
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__*/
|
|
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
|
-
|
|
391
|
-
|
|
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.
|
|
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
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
if (!
|
|
400
|
-
_context6.
|
|
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
|
-
|
|
404
|
-
case
|
|
405
|
-
if (!
|
|
406
|
-
_context6.
|
|
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
|
-
|
|
410
|
-
_context6.
|
|
402
|
+
_t0 = _yield$this$obj$set_t;
|
|
403
|
+
_context6.n = 4;
|
|
411
404
|
break;
|
|
412
|
-
case
|
|
413
|
-
|
|
414
|
-
case
|
|
415
|
-
return _context6.
|
|
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__*/
|
|
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
|
|
464
|
-
while (1) switch (_context7.
|
|
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.
|
|
459
|
+
_context7.n = 1;
|
|
470
460
|
return _event["default"].run.apply(_event["default"], [this, eventName].concat(params));
|
|
471
|
-
case
|
|
472
|
-
return _context7.
|
|
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__*/
|
|
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
|
|
517
|
-
while (1) switch (_context8.
|
|
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.
|
|
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
|
|
530
|
-
|
|
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__*/
|
|
566
|
+
var _toggleOption = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(key, value) {
|
|
581
567
|
var oldval;
|
|
582
|
-
return
|
|
583
|
-
while (1) switch (_context9.
|
|
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.
|
|
573
|
+
_context9.n = 2;
|
|
588
574
|
break;
|
|
589
575
|
}
|
|
590
|
-
_context9.
|
|
576
|
+
_context9.n = 1;
|
|
591
577
|
return this.setOption(key, null);
|
|
592
|
-
case
|
|
593
|
-
_context9.
|
|
578
|
+
case 1:
|
|
579
|
+
_context9.n = 3;
|
|
594
580
|
break;
|
|
595
|
-
case
|
|
596
|
-
_context9.
|
|
581
|
+
case 2:
|
|
582
|
+
_context9.n = 3;
|
|
597
583
|
return this.setOption(key, value);
|
|
598
|
-
case
|
|
599
|
-
|
|
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__*/
|
|
610
|
+
var _setOption = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(key, value) {
|
|
626
611
|
var isChanged;
|
|
627
|
-
return
|
|
628
|
-
while (1) switch (_context0.
|
|
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.
|
|
623
|
+
_context0.n = 1;
|
|
639
624
|
return this.event_run("on_option_change", key, value);
|
|
640
|
-
case
|
|
641
|
-
return _context0.
|
|
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__*/
|
|
679
|
-
return
|
|
680
|
-
while (1) switch (_context1.
|
|
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.
|
|
664
|
+
_context1.p = 0;
|
|
683
665
|
this.setOption(key, value);
|
|
684
666
|
if (!(typeof action === "function")) {
|
|
685
|
-
_context1.
|
|
667
|
+
_context1.n = 1;
|
|
686
668
|
break;
|
|
687
669
|
}
|
|
688
|
-
_context1.
|
|
670
|
+
_context1.n = 1;
|
|
689
671
|
return action();
|
|
690
|
-
case
|
|
691
|
-
_context1.
|
|
672
|
+
case 1:
|
|
673
|
+
_context1.p = 1;
|
|
692
674
|
this.setOption(key, nextvalue);
|
|
693
|
-
return _context1.
|
|
694
|
-
case
|
|
695
|
-
|
|
696
|
-
return _context1.stop();
|
|
675
|
+
return _context1.f(1);
|
|
676
|
+
case 2:
|
|
677
|
+
return _context1.a(2);
|
|
697
678
|
}
|
|
698
|
-
}, _callee1, this, [[0,,
|
|
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__*/
|
|
719
|
-
return
|
|
720
|
-
while (1) switch (_context10.
|
|
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.
|
|
703
|
+
_context10.n = 1;
|
|
723
704
|
return this.setOption("ischanged", this.isChanged);
|
|
724
|
-
case
|
|
725
|
-
|
|
726
|
-
return _context10.stop();
|
|
705
|
+
case 1:
|
|
706
|
+
return _context10.a(2);
|
|
727
707
|
}
|
|
728
708
|
}, _callee10, this);
|
|
729
709
|
}));
|