targetj 1.0.260 → 1.1.1
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/Export.js +3 -0
- package/build/AnimationManager.js +221 -153
- package/build/AnimationUtil.js +0 -1
- package/build/App.js +82 -34
- package/build/BaseModel.js +51 -15
- package/build/Bracket.js +7 -1
- package/build/Easing.js +5 -0
- package/build/EventListener.js +37 -8
- package/build/HtmlToCanvas.js +411 -0
- package/build/LocationManager.js +167 -46
- package/build/PageManager.js +67 -115
- package/build/ParticleChild.js +576 -0
- package/build/ParticleExplode.js +360 -0
- package/build/ParticleRenderer.js +821 -159
- package/build/ParticleRuntime.js +1529 -381
- package/build/ParticleTModel.js +864 -293
- package/build/ParticleUtil.js +120 -172
- package/build/RunScheduler.js +23 -11
- package/build/StateManager.js +206 -57
- package/build/StateUtil.js +141 -82
- package/build/TModel.js +172 -73
- package/build/TModelManager.js +155 -132
- package/build/TModelUtil.js +232 -142
- package/build/TUtil.js +55 -50
- package/build/TargetData.js +26 -12
- package/build/TargetExecutor.js +48 -17
- package/build/TargetManager.js +47 -39
- package/build/TargetParser.js +57 -4
- package/build/TargetUtil.js +211 -129
- package/build/VisibilityUtil.js +4 -2
- package/build/index.js +1 -0
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/TModelUtil.js
CHANGED
|
@@ -2,16 +2,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
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
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
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; }
|
|
5
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
6
|
+
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."); }
|
|
7
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
5
9
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
10
|
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."); }
|
|
7
11
|
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
12
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
9
13
|
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
14
|
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
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
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
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); }
|
|
@@ -48,15 +48,21 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
48
48
|
left = page.scrollLeft || 0;
|
|
49
49
|
top = page.scrollTop || 0;
|
|
50
50
|
window.scrollTo(left, top);
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (!(left === 0 && top === 0)) {
|
|
52
|
+
_context.next = 5;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
return _context.abrupt("return");
|
|
53
56
|
case 5:
|
|
57
|
+
_context.next = 7;
|
|
58
|
+
return new Promise(requestAnimationFrame);
|
|
59
|
+
case 7:
|
|
54
60
|
window.scrollTo(left, top);
|
|
55
|
-
_context.next =
|
|
61
|
+
_context.next = 10;
|
|
56
62
|
return new Promise(requestAnimationFrame);
|
|
57
|
-
case
|
|
63
|
+
case 10:
|
|
58
64
|
window.scrollTo(left, top);
|
|
59
|
-
case
|
|
65
|
+
case 11:
|
|
60
66
|
case "end":
|
|
61
67
|
return _context.stop();
|
|
62
68
|
}
|
|
@@ -80,57 +86,85 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
80
86
|
}, {
|
|
81
87
|
key: "captureDomState",
|
|
82
88
|
value: function captureDomState($root) {
|
|
83
|
-
|
|
89
|
+
var root = $root === null || $root === void 0 ? void 0 : $root.getElement();
|
|
90
|
+
if (!root) {
|
|
84
91
|
return undefined;
|
|
85
92
|
}
|
|
86
|
-
var elements = [$root.getElement()].concat(_toConsumableArray($root.queryAll("*")));
|
|
87
93
|
var controls = [];
|
|
88
94
|
var scrollPositions = [];
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
var doc = root.ownerDocument;
|
|
96
|
+
var focusedElement = doc.activeElement;
|
|
97
|
+
var activeElement = focusedElement === doc.body || focusedElement === doc.documentElement ? null : focusedElement;
|
|
98
|
+
var walker = doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
|
|
99
|
+
var element = root;
|
|
100
|
+
var index = 0;
|
|
101
|
+
var controlIndex = 0;
|
|
102
|
+
var activeIndex = -1;
|
|
103
|
+
while (element) {
|
|
104
|
+
var kind = element.localName;
|
|
105
|
+
if (element === activeElement) {
|
|
106
|
+
activeIndex = index;
|
|
107
|
+
}
|
|
108
|
+
switch (kind) {
|
|
109
|
+
case "input":
|
|
110
|
+
{
|
|
111
|
+
var currentControlIndex = controlIndex++;
|
|
112
|
+
if (element.type !== "file") {
|
|
113
|
+
controls.push({
|
|
114
|
+
index: index,
|
|
115
|
+
controlIndex: currentControlIndex,
|
|
116
|
+
kind: kind,
|
|
117
|
+
value: element.value,
|
|
118
|
+
checked: element.checked,
|
|
119
|
+
indeterminate: element.indeterminate
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "textarea":
|
|
95
125
|
controls.push({
|
|
96
126
|
index: index,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
indeterminate: element.indeterminate
|
|
127
|
+
controlIndex: controlIndex++,
|
|
128
|
+
kind: kind,
|
|
129
|
+
value: element.value
|
|
101
130
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
131
|
+
break;
|
|
132
|
+
case "select":
|
|
133
|
+
{
|
|
134
|
+
var options = element.options;
|
|
135
|
+
var selected = new Array(options.length);
|
|
136
|
+
for (var i = 0; i < options.length; i++) {
|
|
137
|
+
selected[i] = options[i].selected;
|
|
138
|
+
}
|
|
139
|
+
controls.push({
|
|
140
|
+
index: index,
|
|
141
|
+
controlIndex: controlIndex++,
|
|
142
|
+
kind: kind,
|
|
143
|
+
selected: selected
|
|
144
|
+
});
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case "details":
|
|
148
|
+
controls.push({
|
|
149
|
+
index: index,
|
|
150
|
+
controlIndex: controlIndex++,
|
|
151
|
+
kind: kind,
|
|
152
|
+
open: element.open
|
|
153
|
+
});
|
|
154
|
+
break;
|
|
123
155
|
}
|
|
124
|
-
|
|
156
|
+
var scrollLeft = element.scrollLeft;
|
|
157
|
+
var scrollTop = element.scrollTop;
|
|
158
|
+
if (scrollLeft || scrollTop) {
|
|
125
159
|
scrollPositions.push({
|
|
126
160
|
index: index,
|
|
127
|
-
scrollLeft:
|
|
128
|
-
scrollTop:
|
|
161
|
+
scrollLeft: scrollLeft,
|
|
162
|
+
scrollTop: scrollTop
|
|
129
163
|
});
|
|
130
164
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
165
|
+
element = walker.nextNode();
|
|
166
|
+
index++;
|
|
167
|
+
}
|
|
134
168
|
var selection;
|
|
135
169
|
if (activeIndex >= 0 && typeof activeElement.selectionStart === "number") {
|
|
136
170
|
selection = {
|
|
@@ -147,37 +181,60 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
147
181
|
};
|
|
148
182
|
}
|
|
149
183
|
}, {
|
|
150
|
-
key: "
|
|
151
|
-
value: function
|
|
152
|
-
|
|
184
|
+
key: "restoreMountedDom",
|
|
185
|
+
value: function restoreMountedDom($root, domState) {
|
|
186
|
+
var root = $root === null || $root === void 0 ? void 0 : $root.getElement();
|
|
187
|
+
var states = domState === null || domState === void 0 ? void 0 : domState.controls;
|
|
188
|
+
if (!root || !(states !== null && states !== void 0 && states.length)) {
|
|
153
189
|
return;
|
|
154
190
|
}
|
|
155
|
-
var
|
|
156
|
-
var
|
|
191
|
+
var selector = "input,textarea,select,details";
|
|
192
|
+
var offset = root.matches(selector) ? 1 : 0;
|
|
193
|
+
var elements = root.querySelectorAll(selector);
|
|
194
|
+
var _iterator = _createForOfIteratorHelper(states),
|
|
157
195
|
_step;
|
|
158
196
|
try {
|
|
159
|
-
|
|
197
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
160
198
|
var state = _step.value;
|
|
161
|
-
var element = elements[state.
|
|
162
|
-
if (!element) {
|
|
163
|
-
|
|
199
|
+
var element = offset && state.controlIndex === 0 ? root : elements[state.controlIndex - offset];
|
|
200
|
+
if (!element || element.localName !== state.kind) {
|
|
201
|
+
continue;
|
|
164
202
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
203
|
+
switch (state.kind) {
|
|
204
|
+
case "input":
|
|
205
|
+
if (element.value !== state.value) {
|
|
206
|
+
element.value = state.value;
|
|
207
|
+
}
|
|
208
|
+
if (element.checked !== state.checked) {
|
|
209
|
+
element.checked = state.checked;
|
|
210
|
+
}
|
|
211
|
+
if (element.indeterminate !== state.indeterminate) {
|
|
212
|
+
element.indeterminate = state.indeterminate;
|
|
213
|
+
}
|
|
214
|
+
break;
|
|
215
|
+
case "textarea":
|
|
216
|
+
if (element.value !== state.value) {
|
|
217
|
+
element.value = state.value;
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
case "select":
|
|
221
|
+
{
|
|
222
|
+
var options = element.options;
|
|
223
|
+
var selected = state.selected || [];
|
|
224
|
+
for (var i = 0; i < options.length; i++) {
|
|
225
|
+
var value = selected[i] === true;
|
|
226
|
+
if (options[i].selected !== value) {
|
|
227
|
+
options[i].selected = value;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case "details":
|
|
233
|
+
if (element.open !== state.open) {
|
|
234
|
+
element.open = state.open;
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
177
237
|
}
|
|
178
|
-
};
|
|
179
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
180
|
-
if (_loop()) continue;
|
|
181
238
|
}
|
|
182
239
|
} catch (err) {
|
|
183
240
|
_iterator.e(err);
|
|
@@ -189,77 +246,110 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
189
246
|
key: "restoreDomInteractionState",
|
|
190
247
|
value: function () {
|
|
191
248
|
var _restoreDomInteractionState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2($root, domState) {
|
|
192
|
-
var
|
|
249
|
+
var _domState$activeIndex;
|
|
250
|
+
var _ref,
|
|
251
|
+
_ref$focus,
|
|
252
|
+
focus,
|
|
253
|
+
root,
|
|
254
|
+
scrollPositions,
|
|
255
|
+
activeIndex,
|
|
256
|
+
lastScrollIndex,
|
|
257
|
+
lastIndex,
|
|
258
|
+
walker,
|
|
259
|
+
element,
|
|
260
|
+
activeElement,
|
|
261
|
+
scrollIndex,
|
|
262
|
+
index,
|
|
263
|
+
state,
|
|
264
|
+
left,
|
|
265
|
+
top,
|
|
266
|
+
tag,
|
|
267
|
+
editable,
|
|
268
|
+
_activeElement$focus,
|
|
269
|
+
_activeElement,
|
|
270
|
+
_args2 = arguments;
|
|
193
271
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
194
272
|
while (1) switch (_context2.prev = _context2.next) {
|
|
195
273
|
case 0:
|
|
196
|
-
|
|
197
|
-
|
|
274
|
+
_ref = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {}, _ref$focus = _ref.focus, focus = _ref$focus === void 0 ? "editable" : _ref$focus;
|
|
275
|
+
root = $root === null || $root === void 0 ? void 0 : $root.getElement();
|
|
276
|
+
if (!(!root || !domState)) {
|
|
277
|
+
_context2.next = 4;
|
|
198
278
|
break;
|
|
199
279
|
}
|
|
200
280
|
return _context2.abrupt("return");
|
|
201
|
-
case 2:
|
|
202
|
-
_context2.next = 4;
|
|
203
|
-
return new Promise(requestAnimationFrame);
|
|
204
281
|
case 4:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if ((
|
|
211
|
-
_context2.next =
|
|
282
|
+
scrollPositions = domState.scrollPositions || [];
|
|
283
|
+
activeIndex = (_domState$activeIndex = domState.activeIndex) !== null && _domState$activeIndex !== void 0 ? _domState$activeIndex : -1;
|
|
284
|
+
if (root === root.ownerDocument.body && activeIndex === 0) {
|
|
285
|
+
activeIndex = -1;
|
|
286
|
+
}
|
|
287
|
+
if (!(!scrollPositions.length && activeIndex < 0)) {
|
|
288
|
+
_context2.next = 9;
|
|
212
289
|
break;
|
|
213
290
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
291
|
+
return _context2.abrupt("return");
|
|
292
|
+
case 9:
|
|
293
|
+
// Wait only when restoring nonzero scroll positions.
|
|
294
|
+
//if (scrollPositions.length) {
|
|
295
|
+
// await new Promise(requestAnimationFrame);
|
|
296
|
+
//}
|
|
297
|
+
lastScrollIndex = scrollPositions.length ? scrollPositions[scrollPositions.length - 1].index : -1;
|
|
298
|
+
lastIndex = Math.max(activeIndex, lastScrollIndex);
|
|
299
|
+
walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
|
|
300
|
+
element = root;
|
|
301
|
+
scrollIndex = 0;
|
|
302
|
+
for (index = 0; element && index <= lastIndex; index++, element = walker.nextNode()) {
|
|
303
|
+
if (index === activeIndex) {
|
|
304
|
+
activeElement = element;
|
|
305
|
+
}
|
|
306
|
+
if (scrollIndex < scrollPositions.length && scrollPositions[scrollIndex].index === index) {
|
|
307
|
+
state = scrollPositions[scrollIndex++];
|
|
308
|
+
left = element.scrollLeft;
|
|
309
|
+
top = element.scrollTop;
|
|
310
|
+
if (left !== state.scrollLeft) {
|
|
311
|
+
element.scrollLeft = state.scrollLeft;
|
|
312
|
+
}
|
|
313
|
+
if (top !== state.scrollTop) {
|
|
314
|
+
element.scrollTop = state.scrollTop;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (!(!activeElement || focus === "none")) {
|
|
319
|
+
_context2.next = 17;
|
|
218
320
|
break;
|
|
219
321
|
}
|
|
220
|
-
return _context2.abrupt("
|
|
221
|
-
case 13:
|
|
222
|
-
element.scrollLeft = state.scrollLeft;
|
|
223
|
-
element.scrollTop = state.scrollTop;
|
|
224
|
-
case 15:
|
|
225
|
-
_context2.next = 8;
|
|
226
|
-
break;
|
|
322
|
+
return _context2.abrupt("return");
|
|
227
323
|
case 17:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
_iterator2.f();
|
|
237
|
-
return _context2.finish(22);
|
|
238
|
-
case 25:
|
|
239
|
-
activeElement = elements[domState.activeIndex];
|
|
240
|
-
if (activeElement) {
|
|
241
|
-
_context2.next = 28;
|
|
324
|
+
if (!(focus === "editable")) {
|
|
325
|
+
_context2.next = 22;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
tag = activeElement.localName;
|
|
329
|
+
editable = tag === "textarea" || tag === "select" || tag === "input" && activeElement.type !== "hidden" || activeElement.isContentEditable;
|
|
330
|
+
if (editable) {
|
|
331
|
+
_context2.next = 22;
|
|
242
332
|
break;
|
|
243
333
|
}
|
|
244
334
|
return _context2.abrupt("return");
|
|
245
|
-
case
|
|
335
|
+
case 22:
|
|
246
336
|
try {
|
|
247
337
|
activeElement.focus({
|
|
248
338
|
preventScroll: true
|
|
249
339
|
});
|
|
250
340
|
} catch (_unused) {
|
|
251
|
-
(_activeElement$focus = activeElement.focus) === null || _activeElement$focus === void 0 || _activeElement$focus.call(
|
|
341
|
+
(_activeElement$focus = (_activeElement = activeElement).focus) === null || _activeElement$focus === void 0 || _activeElement$focus.call(_activeElement);
|
|
252
342
|
}
|
|
253
343
|
if (domState.selection && typeof activeElement.setSelectionRange === "function") {
|
|
254
344
|
try {
|
|
255
345
|
activeElement.setSelectionRange(domState.selection.start, domState.selection.end, domState.selection.direction);
|
|
256
346
|
} catch (_unused2) {}
|
|
257
347
|
}
|
|
258
|
-
case
|
|
348
|
+
case 24:
|
|
259
349
|
case "end":
|
|
260
350
|
return _context2.stop();
|
|
261
351
|
}
|
|
262
|
-
}, _callee2
|
|
352
|
+
}, _callee2);
|
|
263
353
|
}));
|
|
264
354
|
function restoreDomInteractionState(_x2, _x3) {
|
|
265
355
|
return _restoreDomInteractionState.apply(this, arguments);
|
|
@@ -409,20 +499,20 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
409
499
|
tmodel.domWidthTimestamp = 0;
|
|
410
500
|
tmodel.tfMap = {};
|
|
411
501
|
tmodel.styleMap = {};
|
|
412
|
-
var
|
|
413
|
-
|
|
502
|
+
var _iterator2 = _createForOfIteratorHelper(tmodel.allStyleTargetMap),
|
|
503
|
+
_step2;
|
|
414
504
|
try {
|
|
415
|
-
for (
|
|
416
|
-
var
|
|
417
|
-
key =
|
|
505
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
506
|
+
var _step2$value = _slicedToArray(_step2.value, 1),
|
|
507
|
+
key = _step2$value[0];
|
|
418
508
|
if (TUtil.isDefined(tmodel.val(key))) {
|
|
419
509
|
tmodel.addToStyleTargetList(key);
|
|
420
510
|
}
|
|
421
511
|
}
|
|
422
512
|
} catch (err) {
|
|
423
|
-
|
|
513
|
+
_iterator2.e(err);
|
|
424
514
|
} finally {
|
|
425
|
-
|
|
515
|
+
_iterator2.f();
|
|
426
516
|
}
|
|
427
517
|
}
|
|
428
518
|
}, {
|
|
@@ -503,11 +593,11 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
503
593
|
return;
|
|
504
594
|
}
|
|
505
595
|
var transformChanged = false;
|
|
506
|
-
var
|
|
507
|
-
|
|
596
|
+
var _iterator3 = _createForOfIteratorHelper(originalKeys),
|
|
597
|
+
_step3;
|
|
508
598
|
try {
|
|
509
|
-
for (
|
|
510
|
-
var originalKey =
|
|
599
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
600
|
+
var originalKey = _step3.value;
|
|
511
601
|
var key = TargetUtil.getTargetName(originalKey);
|
|
512
602
|
var value = tmodel.val(key);
|
|
513
603
|
if (!TUtil.isDefined(value)) {
|
|
@@ -546,9 +636,9 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
546
636
|
tmodel.$dom.style(key, styleValue);
|
|
547
637
|
}
|
|
548
638
|
} catch (err) {
|
|
549
|
-
|
|
639
|
+
_iterator3.e(err);
|
|
550
640
|
} finally {
|
|
551
|
-
|
|
641
|
+
_iterator3.f();
|
|
552
642
|
}
|
|
553
643
|
if (transformChanged) {
|
|
554
644
|
var transformValues = _objectSpread(_objectSpread({}, TModelUtil.getTransformBaseFromActualValues(tmodel)), tmodel.tfMap);
|
|
@@ -635,12 +725,12 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
635
725
|
if (!tmodel.asyncStyleTargetMap) {
|
|
636
726
|
return;
|
|
637
727
|
}
|
|
638
|
-
var
|
|
639
|
-
|
|
728
|
+
var _iterator4 = _createForOfIteratorHelper(tmodel.asyncStyleTargetMap),
|
|
729
|
+
_step4;
|
|
640
730
|
try {
|
|
641
|
-
var
|
|
642
|
-
var
|
|
643
|
-
key =
|
|
731
|
+
var _loop = function _loop() {
|
|
732
|
+
var _step4$value = _slicedToArray(_step4.value, 1),
|
|
733
|
+
key = _step4$value[0];
|
|
644
734
|
if (key === 'style') {
|
|
645
735
|
var style = tmodel.getStyle();
|
|
646
736
|
if (TUtil.isDefined(style) && tmodel.styleMap.style !== style) {
|
|
@@ -675,13 +765,13 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
675
765
|
}
|
|
676
766
|
}
|
|
677
767
|
};
|
|
678
|
-
for (
|
|
679
|
-
|
|
768
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
769
|
+
_loop();
|
|
680
770
|
}
|
|
681
771
|
} catch (err) {
|
|
682
|
-
|
|
772
|
+
_iterator4.e(err);
|
|
683
773
|
} finally {
|
|
684
|
-
|
|
774
|
+
_iterator4.f();
|
|
685
775
|
}
|
|
686
776
|
tmodel.asyncStyleTargetMap.clear();
|
|
687
777
|
}
|
|
@@ -749,20 +839,20 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
749
839
|
};
|
|
750
840
|
var firstIdx = function firstIdx(candidates) {
|
|
751
841
|
var best = Infinity;
|
|
752
|
-
var
|
|
753
|
-
|
|
842
|
+
var _iterator5 = _createForOfIteratorHelper(candidates),
|
|
843
|
+
_step5;
|
|
754
844
|
try {
|
|
755
|
-
for (
|
|
756
|
-
var c =
|
|
845
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
846
|
+
var c = _step5.value;
|
|
757
847
|
var i = names.indexOf(c);
|
|
758
848
|
if (i >= 0 && i < best) {
|
|
759
849
|
best = i;
|
|
760
850
|
}
|
|
761
851
|
}
|
|
762
852
|
} catch (err) {
|
|
763
|
-
|
|
853
|
+
_iterator5.e(err);
|
|
764
854
|
} finally {
|
|
765
|
-
|
|
855
|
+
_iterator5.f();
|
|
766
856
|
}
|
|
767
857
|
return best;
|
|
768
858
|
};
|