targetj 1.0.256 → 1.0.257

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,11 +1,21 @@
1
1
  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); }
2
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ 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; }
3
5
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
6
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
7
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
8
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
10
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { 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 && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
17
+ 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); }
18
+ 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); }); }; }
9
19
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
10
20
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
11
21
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -28,6 +38,235 @@ var TModelUtil = /*#__PURE__*/function () {
28
38
  _classCallCheck(this, TModelUtil);
29
39
  }
30
40
  return _createClass(TModelUtil, null, [{
41
+ key: "restoreScroll",
42
+ value: function () {
43
+ var _restoreScroll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page) {
44
+ var left, top;
45
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
46
+ while (1) switch (_context.prev = _context.next) {
47
+ case 0:
48
+ left = page.scrollLeft || 0;
49
+ top = page.scrollTop || 0;
50
+ window.scrollTo(left, top);
51
+ _context.next = 5;
52
+ return new Promise(requestAnimationFrame);
53
+ case 5:
54
+ window.scrollTo(left, top);
55
+ _context.next = 8;
56
+ return new Promise(requestAnimationFrame);
57
+ case 8:
58
+ window.scrollTo(left, top);
59
+ case 9:
60
+ case "end":
61
+ return _context.stop();
62
+ }
63
+ }, _callee);
64
+ }));
65
+ function restoreScroll(_x) {
66
+ return _restoreScroll.apply(this, arguments);
67
+ }
68
+ return restoreScroll;
69
+ }()
70
+ }, {
71
+ key: "getRootDom",
72
+ value: function getRootDom() {
73
+ return $Dom.query("#tgjs-root") ? new $Dom("#tgjs-root") : new $Dom("body");
74
+ }
75
+ }, {
76
+ key: "getPageDom",
77
+ value: function getPageDom() {
78
+ return new $Dom("body");
79
+ }
80
+ }, {
81
+ key: "captureDomState",
82
+ value: function captureDomState($root) {
83
+ if (!($root !== null && $root !== void 0 && $root.getElement())) {
84
+ return undefined;
85
+ }
86
+ var elements = [$root.getElement()].concat(_toConsumableArray($root.queryAll("*")));
87
+ var controls = [];
88
+ var scrollPositions = [];
89
+ elements.forEach(function (element, index) {
90
+ var _element$tagName;
91
+ var tagName = (_element$tagName = element.tagName) === null || _element$tagName === void 0 ? void 0 : _element$tagName.toLowerCase();
92
+ if (tagName === "input") {
93
+ var type = (element.type || "text").toLowerCase();
94
+ if (type !== "file") {
95
+ controls.push({
96
+ index: index,
97
+ kind: "input",
98
+ value: element.value,
99
+ checked: element.checked,
100
+ indeterminate: element.indeterminate
101
+ });
102
+ }
103
+ } else if (tagName === "textarea") {
104
+ controls.push({
105
+ index: index,
106
+ kind: "textarea",
107
+ value: element.value
108
+ });
109
+ } else if (tagName === "select") {
110
+ controls.push({
111
+ index: index,
112
+ kind: "select",
113
+ selected: _toConsumableArray(element.options).map(function (option) {
114
+ return option.selected;
115
+ })
116
+ });
117
+ } else if (tagName === "details") {
118
+ controls.push({
119
+ index: index,
120
+ kind: "details",
121
+ open: element.open
122
+ });
123
+ }
124
+ if (element.scrollLeft || element.scrollTop) {
125
+ scrollPositions.push({
126
+ index: index,
127
+ scrollLeft: element.scrollLeft,
128
+ scrollTop: element.scrollTop
129
+ });
130
+ }
131
+ });
132
+ var activeElement = document.activeElement;
133
+ var activeIndex = activeElement && $root.contains(activeElement) ? elements.indexOf(activeElement) : -1;
134
+ var selection;
135
+ if (activeIndex >= 0 && typeof activeElement.selectionStart === "number") {
136
+ selection = {
137
+ start: activeElement.selectionStart,
138
+ end: activeElement.selectionEnd,
139
+ direction: activeElement.selectionDirection
140
+ };
141
+ }
142
+ return {
143
+ controls: controls,
144
+ scrollPositions: scrollPositions,
145
+ activeIndex: activeIndex,
146
+ selection: selection
147
+ };
148
+ }
149
+ }, {
150
+ key: "restoreDomState",
151
+ value: function restoreDomState($root, domState) {
152
+ if (!($root !== null && $root !== void 0 && $root.getElement()) || !domState) {
153
+ return;
154
+ }
155
+ var elements = [$root.getElement()].concat(_toConsumableArray($root.queryAll("*")));
156
+ var _iterator = _createForOfIteratorHelper(domState.controls || []),
157
+ _step;
158
+ try {
159
+ var _loop = function _loop() {
160
+ var state = _step.value;
161
+ var element = elements[state.index];
162
+ if (!element) {
163
+ return 1; // continue
164
+ }
165
+ if (state.kind === "input") {
166
+ element.value = state.value;
167
+ element.checked = state.checked;
168
+ element.indeterminate = state.indeterminate;
169
+ } else if (state.kind === "textarea") {
170
+ element.value = state.value;
171
+ } else if (state.kind === "select") {
172
+ _toConsumableArray(element.options).forEach(function (option, index) {
173
+ option.selected = state.selected[index] === true;
174
+ });
175
+ } else if (state.kind === "details") {
176
+ element.open = state.open;
177
+ }
178
+ };
179
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
180
+ if (_loop()) continue;
181
+ }
182
+ } catch (err) {
183
+ _iterator.e(err);
184
+ } finally {
185
+ _iterator.f();
186
+ }
187
+ }
188
+ }, {
189
+ key: "restoreDomInteractionState",
190
+ value: function () {
191
+ var _restoreDomInteractionState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2($root, domState) {
192
+ var elements, _iterator2, _step2, state, element, activeElement, _activeElement$focus;
193
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
194
+ while (1) switch (_context2.prev = _context2.next) {
195
+ case 0:
196
+ if (!(!($root !== null && $root !== void 0 && $root.getElement()) || !domState)) {
197
+ _context2.next = 2;
198
+ break;
199
+ }
200
+ return _context2.abrupt("return");
201
+ case 2:
202
+ _context2.next = 4;
203
+ return new Promise(requestAnimationFrame);
204
+ case 4:
205
+ elements = [$root.getElement()].concat(_toConsumableArray($root.queryAll("*")));
206
+ _iterator2 = _createForOfIteratorHelper(domState.scrollPositions || []);
207
+ _context2.prev = 6;
208
+ _iterator2.s();
209
+ case 8:
210
+ if ((_step2 = _iterator2.n()).done) {
211
+ _context2.next = 17;
212
+ break;
213
+ }
214
+ state = _step2.value;
215
+ element = elements[state.index];
216
+ if (element) {
217
+ _context2.next = 13;
218
+ break;
219
+ }
220
+ return _context2.abrupt("continue", 15);
221
+ case 13:
222
+ element.scrollLeft = state.scrollLeft;
223
+ element.scrollTop = state.scrollTop;
224
+ case 15:
225
+ _context2.next = 8;
226
+ break;
227
+ case 17:
228
+ _context2.next = 22;
229
+ break;
230
+ case 19:
231
+ _context2.prev = 19;
232
+ _context2.t0 = _context2["catch"](6);
233
+ _iterator2.e(_context2.t0);
234
+ case 22:
235
+ _context2.prev = 22;
236
+ _iterator2.f();
237
+ return _context2.finish(22);
238
+ case 25:
239
+ activeElement = elements[domState.activeIndex];
240
+ if (activeElement) {
241
+ _context2.next = 28;
242
+ break;
243
+ }
244
+ return _context2.abrupt("return");
245
+ case 28:
246
+ try {
247
+ activeElement.focus({
248
+ preventScroll: true
249
+ });
250
+ } catch (_unused) {
251
+ (_activeElement$focus = activeElement.focus) === null || _activeElement$focus === void 0 || _activeElement$focus.call(activeElement);
252
+ }
253
+ if (domState.selection && typeof activeElement.setSelectionRange === "function") {
254
+ try {
255
+ activeElement.setSelectionRange(domState.selection.start, domState.selection.end, domState.selection.direction);
256
+ } catch (_unused2) {}
257
+ }
258
+ case 30:
259
+ case "end":
260
+ return _context2.stop();
261
+ }
262
+ }, _callee2, null, [[6, 19, 22, 25]]);
263
+ }));
264
+ function restoreDomInteractionState(_x2, _x3) {
265
+ return _restoreDomInteractionState.apply(this, arguments);
266
+ }
267
+ return restoreDomInteractionState;
268
+ }()
269
+ }, {
31
270
  key: "getMarginValue",
32
271
  value: function getMarginValue(tmodel, side) {
33
272
  var margin = tmodel.val("margin");
@@ -170,20 +409,20 @@ var TModelUtil = /*#__PURE__*/function () {
170
409
  tmodel.domWidthTimestamp = 0;
171
410
  tmodel.tfMap = {};
172
411
  tmodel.styleMap = {};
173
- var _iterator = _createForOfIteratorHelper(tmodel.allStyleTargetMap),
174
- _step;
412
+ var _iterator3 = _createForOfIteratorHelper(tmodel.allStyleTargetMap),
413
+ _step3;
175
414
  try {
176
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
177
- var _step$value = _slicedToArray(_step.value, 1),
178
- key = _step$value[0];
415
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
416
+ var _step3$value = _slicedToArray(_step3.value, 1),
417
+ key = _step3$value[0];
179
418
  if (TUtil.isDefined(tmodel.val(key))) {
180
419
  tmodel.addToStyleTargetList(key);
181
420
  }
182
421
  }
183
422
  } catch (err) {
184
- _iterator.e(err);
423
+ _iterator3.e(err);
185
424
  } finally {
186
- _iterator.f();
425
+ _iterator3.f();
187
426
  }
188
427
  }
189
428
  }, {
@@ -202,68 +441,120 @@ var TModelUtil = /*#__PURE__*/function () {
202
441
  }, {
203
442
  key: "fixStyle",
204
443
  value: function fixStyle(tmodel) {
205
- if (!tmodel.styleTargetMap) {
444
+ if (!tmodel.styleTargetMap || !tmodel.hasDom()) {
206
445
  return;
207
446
  }
208
447
  var transformUpdate = false;
209
- var _iterator2 = _createForOfIteratorHelper(tmodel.styleTargetMap),
210
- _step2;
448
+ for (var _i = 0, _arr = _toConsumableArray(tmodel.styleTargetMap); _i < _arr.length; _i++) {
449
+ var _arr$_i = _slicedToArray(_arr[_i], 1),
450
+ key = _arr$_i[0];
451
+ if (tmodel.isKeyAnimating(key)) {
452
+ continue;
453
+ }
454
+ if (TargetData.transformMap[key]) {
455
+ var value = TModelUtil.getTransformValue(tmodel, key);
456
+ if (tmodel.tfMap[key] !== value) {
457
+ tmodel.tfMap[key] = value;
458
+ transformUpdate = true;
459
+ }
460
+ } else if (key === 'dim') {
461
+ var dim = Math.floor(tmodel.val('dim'));
462
+ if (tmodel.styleMap['height'] !== dim || tmodel.$dom.getStyleValue('height') !== dim) {
463
+ tmodel.styleMap['height'] = dim;
464
+ tmodel.$dom.height(dim);
465
+ }
466
+ if (tmodel.styleMap['width'] !== dim || tmodel.$dom.getStyleValue('width') !== dim) {
467
+ tmodel.styleMap['width'] = dim;
468
+ tmodel.$dom.width(dim);
469
+ }
470
+ } else if (key === 'width') {
471
+ var width = Math.floor(tmodel.getWidth());
472
+ if (tmodel.styleMap['width'] !== width || tmodel.$dom.getStyleValue('width') !== width) {
473
+ tmodel.styleMap['width'] = width;
474
+ tmodel.$dom.width(width);
475
+ }
476
+ } else if (key === 'height') {
477
+ var height = Math.floor(tmodel.getHeight());
478
+ if (tmodel.styleMap['height'] !== height || tmodel.$dom.getStyleValue('height') !== height) {
479
+ tmodel.styleMap['height'] = height;
480
+ tmodel.$dom.height(height);
481
+ }
482
+ } else if (TargetData.styleWithUnitMap[key]) {
483
+ if (TUtil.isDefined(tmodel.val(key)) && tmodel.styleMap[key] !== tmodel.val(key)) {
484
+ tmodel.$dom.style(key, TUtil.isNumber(tmodel.val(key)) ? "".concat(tmodel.val(key), "px") : tmodel.val(key));
485
+ tmodel.styleMap[key] = tmodel.val(key);
486
+ }
487
+ } else {
488
+ if (TUtil.isDefined(tmodel.val(key)) && tmodel.styleMap[key] !== tmodel.val(key)) {
489
+ tmodel.$dom.style(key, "".concat(tmodel.val(key)));
490
+ tmodel.styleMap[key] = tmodel.val(key);
491
+ }
492
+ }
493
+ }
494
+ if (transformUpdate) {
495
+ tmodel.$dom.transform(TModelUtil.getTransformString(tmodel, tmodel.tfMap));
496
+ }
497
+ tmodel.styleTargetMap.clear();
498
+ }
499
+ }, {
500
+ key: "commitAnimatedStyles",
501
+ value: function commitAnimatedStyles(tmodel, originalKeys) {
502
+ if (!tmodel.hasDom() || !(originalKeys !== null && originalKeys !== void 0 && originalKeys.size)) {
503
+ return;
504
+ }
505
+ var transformChanged = false;
506
+ var _iterator4 = _createForOfIteratorHelper(originalKeys),
507
+ _step4;
211
508
  try {
212
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
213
- var _step2$value = _slicedToArray(_step2.value, 1),
214
- key = _step2$value[0];
215
- if (tmodel.isKeyAnimating(key)) {
509
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
510
+ var originalKey = _step4.value;
511
+ var key = TargetUtil.getTargetName(originalKey);
512
+ var value = tmodel.val(key);
513
+ if (!TUtil.isDefined(value)) {
216
514
  continue;
217
515
  }
218
516
  if (TargetData.transformMap[key]) {
219
- var value = TModelUtil.getTransformValue(tmodel, key);
220
- if (tmodel.tfMap[key] !== value) {
221
- tmodel.tfMap[key] = value;
222
- transformUpdate = true;
223
- }
224
- } else if (key === 'dim') {
225
- var dim = Math.floor(tmodel.val('dim'));
226
- if (tmodel.styleMap['height'] !== dim || tmodel.$dom.getStyleValue('height') !== dim) {
227
- tmodel.styleMap['height'] = dim;
228
- tmodel.$dom.height(dim);
229
- }
230
- if (tmodel.styleMap['width'] !== dim || tmodel.$dom.getStyleValue('width') !== dim) {
231
- tmodel.styleMap['width'] = dim;
232
- tmodel.$dom.width(dim);
233
- }
234
- } else if (key === 'width') {
235
- var width = Math.floor(tmodel.getWidth());
236
- if (tmodel.styleMap['width'] !== width || tmodel.$dom.getStyleValue('width') !== width) {
237
- tmodel.styleMap['width'] = width;
238
- tmodel.$dom.width(width);
239
- }
240
- } else if (key === 'height') {
241
- var height = Math.floor(tmodel.getHeight());
242
- if (tmodel.styleMap['height'] !== height || tmodel.$dom.getStyleValue('height') !== height) {
243
- tmodel.styleMap['height'] = height;
244
- tmodel.$dom.height(height);
245
- }
246
- } else if (TargetData.styleWithUnitMap[key]) {
247
- if (TUtil.isDefined(tmodel.val(key)) && tmodel.styleMap[key] !== tmodel.val(key)) {
248
- tmodel.$dom.style(key, TUtil.isNumber(tmodel.val(key)) ? "".concat(tmodel.val(key), "px") : tmodel.val(key));
249
- tmodel.styleMap[key] = tmodel.val(key);
250
- }
251
- } else {
252
- if (TUtil.isDefined(tmodel.val(key)) && tmodel.styleMap[key] !== tmodel.val(key)) {
253
- tmodel.$dom.style(key, "".concat(tmodel.val(key)));
254
- tmodel.styleMap[key] = tmodel.val(key);
517
+ var transformValue = TModelUtil.getTransformValue(tmodel, key);
518
+ if (TUtil.isDefined(transformValue)) {
519
+ tmodel.tfMap[key] = transformValue;
520
+ transformChanged = true;
255
521
  }
522
+ continue;
523
+ }
524
+ if (key === "dim") {
525
+ var dim = Math.floor(value);
526
+ tmodel.styleMap.width = dim;
527
+ tmodel.styleMap.height = dim;
528
+ tmodel.$dom.width(dim);
529
+ tmodel.$dom.height(dim);
530
+ continue;
256
531
  }
532
+ if (key === "width") {
533
+ var width = Math.floor(value);
534
+ tmodel.styleMap.width = width;
535
+ tmodel.$dom.width(width);
536
+ continue;
537
+ }
538
+ if (key === "height") {
539
+ var height = Math.floor(value);
540
+ tmodel.styleMap.height = height;
541
+ tmodel.$dom.height(height);
542
+ continue;
543
+ }
544
+ var styleValue = typeof value === "number" && TargetData.styleWithUnitMap[key] ? "".concat(value, "px") : "".concat(value);
545
+ tmodel.styleMap[key] = value;
546
+ tmodel.$dom.style(key, styleValue);
257
547
  }
258
548
  } catch (err) {
259
- _iterator2.e(err);
549
+ _iterator4.e(err);
260
550
  } finally {
261
- _iterator2.f();
551
+ _iterator4.f();
262
552
  }
263
- if (transformUpdate) {
264
- tmodel.$dom.transform(TModelUtil.getTransformString(tmodel, tmodel.tfMap));
553
+ if (transformChanged) {
554
+ var transformValues = _objectSpread(_objectSpread({}, TModelUtil.getTransformBaseFromActualValues(tmodel)), tmodel.tfMap);
555
+ var transform = TModelUtil.getTransformString(tmodel, transformValues);
556
+ tmodel.$dom.transform(transform, tmodel.val("transformOrder"));
265
557
  }
266
- tmodel.styleTargetMap.clear();
267
558
  }
268
559
  }, {
269
560
  key: "setWidthFromDom",
@@ -344,12 +635,12 @@ var TModelUtil = /*#__PURE__*/function () {
344
635
  if (!tmodel.asyncStyleTargetMap) {
345
636
  return;
346
637
  }
347
- var _iterator3 = _createForOfIteratorHelper(tmodel.asyncStyleTargetMap),
348
- _step3;
638
+ var _iterator5 = _createForOfIteratorHelper(tmodel.asyncStyleTargetMap),
639
+ _step5;
349
640
  try {
350
- var _loop = function _loop() {
351
- var _step3$value = _slicedToArray(_step3.value, 1),
352
- key = _step3$value[0];
641
+ var _loop2 = function _loop2() {
642
+ var _step5$value = _slicedToArray(_step5.value, 1),
643
+ key = _step5$value[0];
353
644
  if (key === 'style') {
354
645
  var style = tmodel.getStyle();
355
646
  if (TUtil.isDefined(style) && tmodel.styleMap.style !== style) {
@@ -384,13 +675,13 @@ var TModelUtil = /*#__PURE__*/function () {
384
675
  }
385
676
  }
386
677
  };
387
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
388
- _loop();
678
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
679
+ _loop2();
389
680
  }
390
681
  } catch (err) {
391
- _iterator3.e(err);
682
+ _iterator5.e(err);
392
683
  } finally {
393
- _iterator3.f();
684
+ _iterator5.f();
394
685
  }
395
686
  tmodel.asyncStyleTargetMap.clear();
396
687
  }
@@ -458,20 +749,20 @@ var TModelUtil = /*#__PURE__*/function () {
458
749
  };
459
750
  var firstIdx = function firstIdx(candidates) {
460
751
  var best = Infinity;
461
- var _iterator4 = _createForOfIteratorHelper(candidates),
462
- _step4;
752
+ var _iterator6 = _createForOfIteratorHelper(candidates),
753
+ _step6;
463
754
  try {
464
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
465
- var c = _step4.value;
755
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
756
+ var c = _step6.value;
466
757
  var i = names.indexOf(c);
467
758
  if (i >= 0 && i < best) {
468
759
  best = i;
469
760
  }
470
761
  }
471
762
  } catch (err) {
472
- _iterator4.e(err);
763
+ _iterator6.e(err);
473
764
  } finally {
474
- _iterator4.f();
765
+ _iterator6.f();
475
766
  }
476
767
  return best;
477
768
  };
@@ -583,8 +874,8 @@ var TModelUtil = /*#__PURE__*/function () {
583
874
  var transformMap = {};
584
875
  var hasExplicitTranslate = TUtil.isDefined(values.translateX) || TUtil.isDefined(values.translateY) || TUtil.isDefined(values.translateZ);
585
876
  var keys = Object.keys(values);
586
- for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
587
- var key = _keys[_i];
877
+ for (var _i2 = 0, _keys = keys; _i2 < _keys.length; _i2++) {
878
+ var key = _keys[_i2];
588
879
  if (processed[key]) {
589
880
  continue;
590
881
  }
package/build/TUtil.js CHANGED
@@ -36,6 +36,13 @@ var TUtil = /*#__PURE__*/function () {
36
36
  }
37
37
  return false;
38
38
  }
39
+ }, {
40
+ key: "uniqueTModels",
41
+ value: function uniqueTModels(tmodels) {
42
+ return _toConsumableArray(new Map(tmodels.filter(Boolean).map(function (tmodel) {
43
+ return [tmodel.oid, tmodel];
44
+ })).values());
45
+ }
39
46
  }, {
40
47
  key: "list2map",
41
48
  value: function list2map(list, defaultValue) {